diff --git a/modules/app_perl/perlfunc.c b/modules/app_perl/perlfunc.c index 96f7596..90a80d4 100644 --- a/modules/app_perl/perlfunc.c +++ b/modules/app_perl/perlfunc.c @@ -127,16 +127,15 @@ int perl_exec2(struct sip_msg* _msg, char* fnc, char* mystr) { return -1; } - m = sv_newmortal(); - sv_setref_pv(m, "Kamailio::Message", (void *)_msg); - SvREADONLY_on(SvRV(m)); - - ENTER; /* everything created after here */ SAVETMPS; /* ...is a temporary variable. */ - PUSHMARK(SP); /* remember the stack pointer */ + PUSHMARK(SP); /* remember the stack pointer */ XPUSHs(m); /* Our reference to the stack... */ + m = sv_newmortal(); + sv_setref_pv(m, "Kamailio::Message", (void *)_msg); + SvREADONLY_on(SvRV(m)); + if (mystr) XPUSHs(sv_2mortal(newSVpv(mystr, strlen(mystr)))); /* Our string to the stack... */