You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Gerald Richter <ri...@ecos.de> on 2002/05/27 12:29:58 UTC

PerlSetEnv not available inside of PerlRequire script

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: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: PerlSetEnv not available inside of PerlRequire script

Posted by Gerald Richter - ecos gmbh <ri...@ecos.de>.
> On Mon, 27 May 2002, Gerald Richter wrote:
>
> > ok, this looks better, but I don't see the PassEnv setting?
>
> should be there now, my first patch had only applied SetEnv, both are done
> now.
>

Thanks,

it's working now as it should for me :-)

Gerald


-------------------------------------------------------------
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: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: PerlSetEnv not available inside of PerlRequire script

Posted by Doug MacEachern <do...@covalent.net>.
On Mon, 27 May 2002, Gerald Richter wrote:

> ok, this looks better, but I don't see the PassEnv setting?

should be there now, my first patch had only applied SetEnv, both are done 
now.


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


Re: PerlSetEnv not available inside of PerlRequire script

Posted by Gerald Richter <ri...@ecos.de>.
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.
>
> i made a different change that should work the same, but made some of the
> code re-usable.  not tested beyond 'make test', but it should be ok.
>

ok, this looks better, but I don't see the PassEnv setting?

I just did a quick look at the commit mail, I will test it out tomorrow. I
have to go to bed now....

Gerald


-------------------------------------------------------------
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: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: PerlSetEnv not available inside of PerlRequire script

Posted by Doug MacEachern <do...@covalent.net>.
On Mon, 27 May 2002, Gerald Richter wrote:

> 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.

i made a different change that should work the same, but made some of the 
code re-usable.  not tested beyond 'make test', but it should be ok.
 
> 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.

i prefer review in most cases.  but also trust your judgement if you have 
a change you don't feel needs review.


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