[I hoped that someone will reply to this trivial mp1 question, but nobody did for a week. Please help us spend less time answering emails, that others can easily handle, so we can concentrate on coding and asnwering more complicated emails. Thank you.]

Sreeji K Das wrote:
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

So it does the right thing in the mod_perl handler.


Access #2: http://host:4444/cgivar/env.pl prints:
CGI: MY_HOME is ::

which is a mod_cgi script. None of the Perl* directives affect code running mod_cgi.


So the description at:
http://perl.apache.org/docs/1.0/guide/config.html#PerlSetEnv_and_PerlPassEnv

I doubt we need to say that it doesn't affect mod_cgi, since we will need to do that for each and every Perl* directive. If you think we should, I'd rather do it in one place in guide/config.pod, for example:

=head3 Do Perl* Directives Affect Code Running under mod_cgi?

No, they don't.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html



Reply via email to