浏览代码

app_perl: print the error string if execution of perl script sets it

Daniel-Constantin Mierla 3 年之前
父节点
当前提交
8c910452cf
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/modules/app_perl/perlfunc.c

+ 5 - 0
src/modules/app_perl/perlfunc.c

@@ -147,6 +147,11 @@ int perl_exec2(struct sip_msg* _msg, char* fnc, char* mystr) {
 	PUTBACK;			/* make local stack pointer global */
 	PUTBACK;			/* make local stack pointer global */
 
 
 	call_pv(fnc, G_EVAL|G_SCALAR);		/* call the function     */
 	call_pv(fnc, G_EVAL|G_SCALAR);		/* call the function     */
+
+	if(SvTRUE(ERRSV)) {
+		LM_WARN("perl error: %s\n", SvPV_nolen(ERRSV));
+	}
+
 	SPAGAIN;			/* refresh stack pointer         */
 	SPAGAIN;			/* refresh stack pointer         */
 	/* pop the return value from stack */
 	/* pop the return value from stack */
 	retval = POPi;
 	retval = POPi;