perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sreeji K Das <sreej...@yahoo.com>
Subject [MP2 BUG] PerlPassEnv issues
Date Mon, 07 Jul 2003 09:35:43 GMT
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/

Mime
View raw message