I wrote:
>
> The attached tiny patch (not intended for application yet) provides a
> space for plperl functions to create and share session persistent
> data, which I should think would increase the utility of plperl.
> Essentially it creates a hash called %session_globals which it then
> injects into the safe container where plperl functions live.
>
...and the patch is attached here
Index: src/pl/plperl/plperl.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/pl/plperl/plperl.c,v
retrieving revision 1.42
diff -c -w -r1.42 plperl.c
*** src/pl/plperl/plperl.c 6 Jan 2004 23:55:19 -0000 1.42
--- src/pl/plperl/plperl.c 8 Feb 2004 17:18:18 -0000
***************
*** 207,215 ****
* no commas between the next 5 please. They are supposed to be
* one string
*/
! "require Safe; SPI::bootstrap();"
"sub ::mksafefunc { my $x = new Safe; $x->permit_only(':default');$x->permit(':base_math');"
! "$x->share(qw[&elog &DEBUG &LOG &INFO &NOTICE &WARNING &ERROR]);"
" return $x->reval(qq[sub { $_[0] }]); }"
"sub ::mkunsafefunc {return eval(qq[ sub { $_[0] } ]); }"
};
--- 207,215 ----
* no commas between the next 5 please. They are supposed to be
* one string
*/
! "require Safe; SPI::bootstrap(); use vars qw(%session_globals);"
"sub ::mksafefunc { my $x = new Safe; $x->permit_only(':default');$x->permit(':base_math');"
! "$x->share(qw[&elog &DEBUG &LOG &INFO &NOTICE &WARNING &ERROR %session_globals]);"
" return $x->reval(qq[sub { $_[0] }]); }"
"sub ::mkunsafefunc {return eval(qq[ sub { $_[0] } ]); }"
};