Commit fd416db4 authored by Andrew Dunstan's avatar Andrew Dunstan

Initialise perl library as documented in perl API. Backpatch to release 7.4.

parent 5d682cab
/********************************************************************** /**********************************************************************
* plperl.c - perl as a procedural language for PostgreSQL * plperl.c - perl as a procedural language for PostgreSQL
* *
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.146 2009/02/20 10:39:19 petere Exp $ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.147 2009/06/04 15:59:55 adunstan Exp $
* *
**********************************************************************/ **********************************************************************/
...@@ -399,6 +399,8 @@ plperl_init_interp(void) ...@@ -399,6 +399,8 @@ plperl_init_interp(void)
"", "-e", PERLBOOT "", "-e", PERLBOOT
}; };
int nargs = 3;
#ifdef WIN32 #ifdef WIN32
/* /*
...@@ -442,13 +444,19 @@ plperl_init_interp(void) ...@@ -442,13 +444,19 @@ plperl_init_interp(void)
#endif #endif
#ifdef PERL_SYS_INIT3
/* only call this the first time through, as per perlembed man page */
if (interp_state == INTERP_NONE)
PERL_SYS_INIT3(&nargs, (char ***) &embedding, NULL);
#endif
plperl_held_interp = perl_alloc(); plperl_held_interp = perl_alloc();
if (!plperl_held_interp) if (!plperl_held_interp)
elog(ERROR, "could not allocate Perl interpreter"); elog(ERROR, "could not allocate Perl interpreter");
perl_construct(plperl_held_interp); perl_construct(plperl_held_interp);
perl_parse(plperl_held_interp, plperl_init_shared_libs, perl_parse(plperl_held_interp, plperl_init_shared_libs,
3, embedding, NULL); nargs, embedding, NULL);
perl_run(plperl_held_interp); perl_run(plperl_held_interp);
if (interp_state == INTERP_NONE) if (interp_state == INTERP_NONE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment