Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fd416db

Browse files
committed
Initialise perl library as documented in perl API. Backpatch to release 7.4.
1 parent 5d682ca commit fd416db

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/pl/plperl/plperl.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**********************************************************************
22
* plperl.c - perl as a procedural language for PostgreSQL
33
*
4-
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.146 2009/02/20 10:39:19 petere Exp $
4+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.147 2009/06/04 15:59:55 adunstan Exp $
55
*
66
**********************************************************************/
77

@@ -399,6 +399,8 @@ plperl_init_interp(void)
399399
"", "-e", PERLBOOT
400400
};
401401

402+
int nargs = 3;
403+
402404
#ifdef WIN32
403405

404406
/*
@@ -442,13 +444,19 @@ plperl_init_interp(void)
442444
#endif
443445

444446

447+
#ifdef PERL_SYS_INIT3
448+
/* only call this the first time through, as per perlembed man page */
449+
if (interp_state == INTERP_NONE)
450+
PERL_SYS_INIT3(&nargs, (char ***) &embedding, NULL);
451+
#endif
452+
445453
plperl_held_interp = perl_alloc();
446454
if (!plperl_held_interp)
447455
elog(ERROR, "could not allocate Perl interpreter");
448456

449457
perl_construct(plperl_held_interp);
450458
perl_parse(plperl_held_interp, plperl_init_shared_libs,
451-
3, embedding, NULL);
459+
nargs, embedding, NULL);
452460
perl_run(plperl_held_interp);
453461

454462
if (interp_state == INTERP_NONE)

0 commit comments

Comments
 (0)