Stas Bekman wrote:
Erich Oliphant wrote:

Thanks for the reply, just getting back from a short vacation...

My test programs:

first.pl
---
#!/export/home/eoliphan/gnu/bin/perl -w
use strict;
my $key;
open(LOG,"> /tmp/firstdebug.log");
foreach $key (keys %ENV)
{
print LOG "$key = $ENV{$key} \n";
}

`/export/home/eoliphan/gnu/cgi-bin/dump_vars.pl`;
close (LOG);
---

dump_vars.pl has the same foreach loop and dumps to a different log file.
The 'firstdebug.log' has the required CGI vars. The log generated by
dump_vars.pl has what appears to be the enviroment of the httpd executable
and no CGI vars.

It works for me with mod_perl 1.0 and doesn't with 2.0.
BTW, the 2.0 issue is known. And should be resolved at some point.

Here is a quote from modperl_env.c

/*
 * XXX: what we do here might change:
 *      - make it optional for %ENV to be tied to r->subprocess_env
 *      - make it possible to modify environ
 *      - we could allow modification of environ if mpm isn't threaded
 *      - we could allow modification of environ if variable isn't a CGI
 *        variable (still could cause problems)
 */
/*
 * problems we are trying to solve:
 *      - environ is shared between threads
 *          + Perl does not serialize access to environ
 *          + even if it did, CGI variables cannot be shared between threads!
 * problems we create by trying to solve above problems:
 *      - a forked process will not inherit the current %ENV
 *      - C libraries might rely on environ, e.g. DBD::Oracle
 */

Meanwhile I'll add a note to the compat.pod, to avoid bug reports.

__________________________________________________________________
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

Reply via email to