perl-docs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Richter" <rich...@ecos.de>
Subject PerlSetEnv not available inside of PerlRequire script
Date Mon, 27 May 2002 06:59:27 GMT
Hi,

in mod_perl 2 (CVS from today) are the PerlSetEnv and PerlPassEnv not set in
%ENV while a script is executed with PerlRequire. The following patch solves
this problem.

Gerald

P.S. To save work for you I can directly commit it into the cvs, but I like
to get it reviewed before I do anything stupid or something that just
doesn't fit correctly in the overall concept.

Index: modperl_env.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_env.c,v
retrieving revision 1.20
diff -u -r1.20 modperl_env.c
--- modperl_env.c 19 Nov 2001 00:07:28 -0000 1.20
+++ modperl_env.c 27 May 2002 06:53:38 -0000
@@ -64,8 +64,39 @@

 void modperl_env_configure_server(pTHX_ apr_pool_t *p, server_rec *s)
 {
-    /* XXX: propagate scfg->SetEnv to environ */
+    MP_dSCFG(s);
+    HV *hv = ENVHV;
+    U32 mg_flags;
+    int i;
+    const apr_array_header_t *array;
+    apr_table_entry_t *elts;
+
+    modperl_env_untie(mg_flags);
+
+    array = apr_table_elts(scfg->PassEnv);
+    elts  = (apr_table_entry_t *)array->elts;
+
+    for (i = 0; i < array->nelts; i++) {
+ if (!elts[i].key || !elts[i].val) {
+            continue;
+        }
+        modperl_env_hv_store(aTHX_ hv, &elts[i]);
+    }
+
+    array = apr_table_elts(scfg->SetEnv);
+    elts  = (apr_table_entry_t *)array->elts;
+
+    for (i = 0; i < array->nelts; i++) {
+ if (!elts[i].key || !elts[i].val) {
+            continue;
+        }
+        modperl_env_hv_store(aTHX_ hv, &elts[i]);
+    }
+
+    modperl_env_tie(mg_flags);
 }
+
+

 #define overlay_subprocess_env(r, tab) \
     r->subprocess_env = apr_table_overlay(r->pool, \

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org


Mime
View raw message