This patch possibly does the trick (no test for it yet)

Index: src/modules/perl/modperl_cmd.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.47
diff -u -I$Id -r1.47 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c      16 Apr 2003 03:03:35 -0000      1.47
+++ src/modules/perl/modperl_cmd.c      17 Jul 2003 08:19:11 -0000
@@ -399,6 +399,9 @@
         arg = apr_pstrcat(p, "package ", package_name, ";", arg, NULL);
     }
  
+    /* Populate %ENV */
+    modperl_env_configure_server(aTHX_ p, s);
+
     eval_pv(arg, FALSE);
  
     if (SvTRUE(ERRSV)) {


On Mon, 2003-07-07 at 17:35, Sreeji K Das wrote:
> Looks like PerlSetEnv's are not propagated as
> expected.
> I've pasted my original mail to the list. However,
> after going through the code, it looks like
> scfg->PassEnv is not synced with Perl's %ENV
> structure.
> 
> Following is a simpler example:
> $ cat /tmp/test.conf
> <Perl >
> ;
> </Perl>
> 
> PerlPassEnv MY_TEST_VAR
> <Perl >
> print "MY_TEST_VAR is $ENV{MY_TEST_VAR}\n";
> system("echo \"shell: MY_TEST_VAR = \$MY_TEST_VAR\"");
> </Perl>
> 
> Listen 43499
> 
> $ httpd -X -f /m/aru/conf/test.conf
> MY_TEST_VAR is 
> shell: MY_TEST_VAR = Hello there
> MY_TEST_VAR is 
> shell: MY_TEST_VAR = Hello there
> 
> I think either modperl_cmd_pass_env() should sync the
> vars. as and when it sees one (but this may not be
> efficient). Or, modperl_cmd_perldo() should sync
> (by calling modperl_env_table_populate() ?) before
> doing the eval(). I tried doing this, but couldn't
> figure out how to get a pTHX_ !
> (The same problem would be applicable to PerlSetEnv as
> well, I guess).
> 
> Any temporary hacks to fix this, so that I can
> continue my testing ?
> 
> thx
> Sreeji
> ---------------
> Hi 
> 
> It looks like when I @Include a file from a <Perl>
> section, the <Perl> 
> 
> sections in that file get processed first, though
> there are other stuff 
> 
> before the <Perl> sections.
> Following is an example (simplified from my real-life
> config) :
> 
> $ cat /tmp/test.conf
> <Perl >
> @Include = "/tmp/testvar.conf";
> </Perl>
> Listen 43499
> 
> $ cat /tmp/testvar.conf
> PerlPassEnv MY_TEST_VAR
> <Perl >
> print "MY_TEST_VAR = $ENV{MY_TEST_VAR}\n";
> </Perl>
> 
> $ httpd -X -f /tmp/test.conf
> [Sun Jul 06 06:15:09 2003] [warn] Syntax error at
> /tmp/testvar.conf:5 Use 
> 
> of uninitialized value in concatenation (.) or string
> at (eval 3) line 1.
> 
> So when an Include is found, all perlsections in that
> file are processed. 
> 
> However, as in the above case, these <Perl> sections
> could be depending on 
> 
> the directives defined previously in the file.
> It works if I move the PerlPassEnv to test.conf, above
> the <Perl> section.
> 
> Any thoughts ?
> 
> thx
> Sreeji
> (this is 1.99_10-dev on Linux, with httpd-2.0.45)
> 
> ________________________________________________________________________
> Want to chat instantly with your online friends?  Get the FREE Yahoo!
> Messenger http://uk.messenger.yahoo.com/
-- 
--------------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/    F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to