And here are two more patches to try (all against the fresh cvs). This is similar to one successful path that changes and restores context inside perldo (Apache::PerlSections).

The first one adds the setting of the context inside modules (PerlModule/PerlLoadModule) though it doesn't restore it. The second one restores it as well.

Index: src/modules/perl/modperl_cmd.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.52
diff -u -r1.52 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c      19 Dec 2003 01:17:31 -0000      1.52
+++ src/modules/perl/modperl_cmd.c      22 Jan 2004 00:55:18 -0000
@@ -116,6 +116,7 @@
 #ifdef USE_ITHREADS
         /* XXX: .htaccess support cannot use this perl with threaded MPMs */
         dTHXa(scfg->mip->parent->perl);
+        PERL_SET_CONTEXT(aTHX);
 #endif
         MP_TRACE_d(MP_FUNC, "load PerlModule %s\n", arg);

@@ -373,6 +374,7 @@
 #ifdef USE_ITHREADS
     MP_dSCFG(s);
     pTHX;
+    PerlInterpreter *orig_perl;
 #endif

     if (!(arg && *arg)) {
@@ -388,7 +390,9 @@

 #ifdef USE_ITHREADS
     /* XXX: .htaccess support cannot use this perl with threaded MPMs */
+    orig_perl = PERL_GET_CONTEXT;
     aTHX = scfg->mip->parent->perl;
+    PERL_SET_CONTEXT(aTHX);
 #endif

     /* data will be set by a <Perl> section */
@@ -479,6 +483,11 @@
         }
     }

+#ifdef USE_ITHREADS
+    /* restore the original perl context */
+    PERL_SET_CONTEXT(orig_perl);
+#endif
+
     return NULL;
 }


The second patch:


Index: src/modules/perl/modperl_cmd.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.52
diff -u -r1.52 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c      19 Dec 2003 01:17:31 -0000      1.52
+++ src/modules/perl/modperl_cmd.c      22 Jan 2004 01:07:35 -0000
@@ -105,7 +105,10 @@
 MP_CMD_SRV_DECLARE(modules)
 {
     MP_dSCFG(parms->server);
-
+#ifdef USE_ITHREADS
+    PerlInterpreter *orig_perl;
+#endif
+
     if (modperl_is_running() &&
         modperl_init_vhost(parms->server, parms->pool, NULL) != OK)
     {
@@ -115,7 +118,9 @@
     if (modperl_is_running()) {
 #ifdef USE_ITHREADS
         /* XXX: .htaccess support cannot use this perl with threaded MPMs */
+        orig_perl = PERL_GET_CONTEXT;
         dTHXa(scfg->mip->parent->perl);
+        PERL_SET_CONTEXT(aTHX);
 #endif
         MP_TRACE_d(MP_FUNC, "load PerlModule %s\n", arg);

@@ -128,6 +133,11 @@
         *(const char **)apr_array_push(scfg->PerlModule) = arg;
     }

+#ifdef USE_ITHREADS
+    /* restore the original perl context */
+    PERL_SET_CONTEXT(orig_perl);
+#endif
+
     return NULL;
 }

@@ -373,6 +383,7 @@
 #ifdef USE_ITHREADS
     MP_dSCFG(s);
     pTHX;
+    PerlInterpreter *orig_perl;
 #endif

     if (!(arg && *arg)) {
@@ -388,7 +399,9 @@

 #ifdef USE_ITHREADS
     /* XXX: .htaccess support cannot use this perl with threaded MPMs */
+    orig_perl = PERL_GET_CONTEXT;
     aTHX = scfg->mip->parent->perl;
+    PERL_SET_CONTEXT(aTHX);
 #endif

     /* data will be set by a <Perl> section */
@@ -479,6 +492,11 @@
         }
     }

+#ifdef USE_ITHREADS
+    /* restore the original perl context */
+    PERL_SET_CONTEXT(orig_perl);
+#endif
+
     return NULL;
 }


__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to