I want to access an ENV variable from a CGI script. I
was assuming that PerlPassEnv would do the job of
apache's PassEnv - but looks like PerlPassEnv is not
exactly same as PassEnv in behaviour ?
Following example demonstrates my problem:
% cat test.conf
PerlPassEnv MY_HOME
#PassEnv MY_HOME
Port 4444
ServerRoot /tmp/
ScriptAlias /cgivar/ /tmp/
PerlScript test.pl
<Location '/perlvar'>
SetHandler perl-script
PerlHandler Test
</Location>
% cat test.pl
package Test;
sub handler
{
print "MY_HOME is :$ENV{MY_HOME}:";
}
1;
% cat env.pl
#!/local/bin/perl
print "Content-type: text/html\n\n";
print "CGI: MY_HOME is :$ENV{MY_HOME}:\n";
----
% setenv MY_HOME abcd && httpd-1.3.29 -X -f
/tmp/test.conf
Access #1: http://host:4444/perlvar prints:
MY_HOME is abcd
Access #2: http://host:4444/cgivar/env.pl prints:
CGI: MY_HOME is ::
Now I uncommented the following line in test.conf &
repeated the test after restart:
#PassEnv MY_HOME
Access #1: http://host:4444/perlvar prints:
MY_HOME is abcd
Access #2: http://host:4444/cgivar/env.pl prints:
CGI: MY_HOME is :abcd:
Is this the expected behaviour of PassEnv ? (I guess
PerlSetEnv too behaves the same way). Atleast the
manual page says PassEnv is supposed to be same as
PerlPassEnv:
From
http://perl.apache.org/docs/1.0/guide/config.html#PerlSetEnv_and_PerlPassEnv
"However, Apache (or mod_perl) don't pass on
environment variables from the shell by default;
you'll have to specify these using either the standard
PassEnv or mod_perl's PerlPassEnv directives.
..
While the Apache's SetEnv/PassEnv and mod_perl's
PerlSetEnv/PerlPassEnv apparently do the same thing,
the former doesn't happen until the fixup phase, the
latter happens as soon as possible..."
Am I missing something ? The docs. convey the meaning
that I only need to use PerlPassEnv pass the env. to
CGI scripts.
Btw, this is using a static-httpd-1.3.29/mod_perl-1.29
using perl-5.8.1.
Sorry, I could not get around to read the sources.
Probably I'll do that over the weekend if I don't get
a response :-)
thx
Sreeji
________________________________________________________________________
Want to chat instantly with your online friends? Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html