I am having the following apache configuration file.
==============================
% cat ~/lab/mp2/test/httpd.conf
ServerRoot "/home/pvnaik/lab/mp2/test"
Timeout 300
DocumentRoot "/home/pvnaik/lab/mp2/test/webdocs"
ErrorLog logs/error_log
Listen 44951
PerlModule Apache2
<Perl>
;
</Perl>
PerlSetEnv MyVar "Hello"
<Perl>
print "HELLO = ", $ENV{MyVar}, "\n";
</Perl>
==============================
Now, the output is :
==============================
% ~/lab/mymp2/mp2/bin/httpd -X -f ~/lab/mp2/test/httpd.conf
HELLO =
HELLO =
==============================
This is happening because, initialization of %ENV will take place when
the first <Perl>..</Perl>. And all the subsequent PerlPassEnv and
PerlSetEnv values will be stored only in scfg->SetEnv table and won't
be copied to %ENV.
This issue was previously discussed at
http://gossamer-threads.com/lists/modperl/dev/7256
The same patch would be something like below now :
==============================
% diff -u modperl_cmd.c~ modperl_cmd.c
--- modperl_cmd.c~ 2004-12-14 03:12:14.000000000 -0800
+++ modperl_cmd.c 2004-12-14 09:35:47.000000000 -0800
@@ -545,6 +545,8 @@
ENTER;SAVETMPS;
save_scalar(gv); /* local $0 */
sv_setpv_mg(GvSV(gv), directive->filename);
+ /* Populate %ENV */
+ modperl_env_configure_server(aTHX_ p, s);
eval_pv(arg, FALSE);
FREETMPS;LEAVE;
}
==============================
This patch seems to be working fine for me. But probably, calling
modperl_env_configure_server() for every eval_pv would be a bit
costly.
Another option may be to call modperl_env_hv_store():modperl_env.c
from MP_CMD_SRV_DECLARE2(set_env) and MP_CMD_SRV_DECLARE(pass_env) of
modperl_cmd.c.
Regards,
Pratik
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]