perl script abnormal termination handling

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

perl script abnormal termination handling

Jeff Pyle
Hello,

I run a perl script from an Opensips 1.6 config.  I'm having trouble handling a perl "die" condition in the Opensips script.  For example:

if !(perl_exec("dietest1")) {
    xlog("L_INFO", "Perl script failed.\n"
} else {
    xlog("L_INFO", "Perl script succeeded.\n"
}

where test1.pl ends with:
    die "Perl script dying"

When the perl script fails, I see only:

ERROR:core:XS_OpenSIPS__Message_log: perl error: Perl script dying at /etc/opensips/perl/perltest.pl line 165.#012

I never see the "Perl script failed" xlog from the script.  It seems that a dying perl script stops processing on the current message.  Is there a way around this, to handle the perl error?


Regards,
Jeff



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: perl script abnormal termination handling

Ali Pey
Don't do die in the perl script. Try return 0 or 1.

Regards,
Ali Pey


On Fri, Nov 8, 2013 at 10:32 AM, Jeff Pyle <[hidden email]> wrote:
Hello,

I run a perl script from an Opensips 1.6 config.  I'm having trouble handling a perl "die" condition in the Opensips script.  For example:

if !(perl_exec("dietest1")) {
    xlog("L_INFO", "Perl script failed.\n"
} else {
    xlog("L_INFO", "Perl script succeeded.\n"
}

where test1.pl ends with:
    die "Perl script dying"

When the perl script fails, I see only:

ERROR:core:XS_OpenSIPS__Message_log: perl error: Perl script dying at /etc/opensips/perl/perltest.pl line 165.#012

I never see the "Perl script failed" xlog from the script.  It seems that a dying perl script stops processing on the current message.  Is there a way around this, to handle the perl error?


Regards,
Jeff



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: perl script abnormal termination handling

Jeff Pyle
"return -1" seemed to do the trick.  It caused the perl_exec() function to return a non-successful code so we can handle it accordingly.  Thanks.


- Jeff


On Fri, Nov 8, 2013 at 2:13 PM, Ali Pey <[hidden email]> wrote:
Don't do die in the perl script. Try return 0 or 1.

Regards,
Ali Pey


On Fri, Nov 8, 2013 at 10:32 AM, Jeff Pyle <[hidden email]> wrote:
Hello,

I run a perl script from an Opensips 1.6 config.  I'm having trouble handling a perl "die" condition in the Opensips script.  For example:

if !(perl_exec("dietest1")) {
    xlog("L_INFO", "Perl script failed.\n"
} else {
    xlog("L_INFO", "Perl script succeeded.\n"
}

where test1.pl ends with:
    die "Perl script dying"

When the perl script fails, I see only:

ERROR:core:XS_OpenSIPS__Message_log: perl error: Perl script dying at /etc/opensips/perl/perltest.pl line 165.#012

I never see the "Perl script failed" xlog from the script.  It seems that a dying perl script stops processing on the current message.  Is there a way around this, to handle the perl error?


Regards,
Jeff



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users