*** plperl.c 2004-07-01 23:50:22.000000000 +0300 --- newplperl.c 2004-07-06 11:57:56.000000000 +0300 *************** *** 99,104 **** --- 99,105 ---- static HV *plperl_proc_hash = NULL; AV *g_row_keys = NULL; AV *g_column_keys = NULL; + SV *srf_perlret=NULL; /*keep returned value*/ int g_attr_num = 0; /********************************************************************** *************** *** 839,847 **** /* Find or compile the function */ prodesc = compile_plperl_function(fcinfo->flinfo->fn_oid, false); /************************************************************ ! * Call the Perl function ************************************************************/ ! perlret = plperl_call_perl_func(prodesc, fcinfo); if (prodesc->fn_retistuple && SRF_IS_FIRSTCALL()) { --- 840,855 ---- /* Find or compile the function */ prodesc = compile_plperl_function(fcinfo->flinfo->fn_oid, false); /************************************************************ ! * Call the Perl function if not returning set ************************************************************/ ! if (!prodesc->fn_retistuple) ! perlret = plperl_call_perl_func(prodesc, fcinfo); ! else { ! if (SRF_IS_FIRSTCALL()) /*call function only once*/ ! srf_perlret = plperl_call_perl_func(prodesc, fcinfo); ! perlret = srf_perlret; ! } ! if (prodesc->fn_retistuple && SRF_IS_FIRSTCALL()) {