Initialise perl library as documented in perl API. Backpatch to release 7.4.
authorAndrew Dunstan <[email protected]>
Thu, 4 Jun 2009 16:01:23 +0000 (16:01 +0000)
committerAndrew Dunstan <[email protected]>
Thu, 4 Jun 2009 16:01:23 +0000 (16:01 +0000)
src/pl/plperl/plperl.c

index 3aa551cdbe02153f758581035e8053a5218233bf..3a34e64881545bd23cc1293aa97c8cf75c365f54 100644 (file)
@@ -33,7 +33,7 @@
  *   ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.40.2.1 2005/01/26 17:09:21 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.40.2.2 2009/06/04 16:01:23 adunstan Exp $
  *
  **********************************************************************/
 
@@ -214,12 +214,18 @@ plperl_init_interp(void)
        "sub ::mkunsafefunc {return eval(qq[ sub { $_[0] } ]); }"
    };
 
+   int nargs = 3;
+
+#ifdef PERL_SYS_INIT3
+   PERL_SYS_INIT3(&nargs, (char ***) &embedding, NULL);
+#endif
+
    plperl_interp = perl_alloc();
    if (!plperl_interp)
        elog(ERROR, "could not allocate perl interpreter");
 
    perl_construct(plperl_interp);
-   perl_parse(plperl_interp, plperl_init_shared_libs, 3, embedding, NULL);
+   perl_parse(plperl_interp, plperl_init_shared_libs, nargs, embedding, NULL);
    perl_run(plperl_interp);
 
    /************************************************************