Larry Leszczynski wrote:
Hi all -I'm having trouble using server->dir_config in my startup.pl to read variables set by PerlSetVar inside a Perl section. I'm using Perl 5.6.1, Apache 1.3.27, and mod_perl 1.27.
[snip]
you may be running into an odditity of PerlSetVar. internally, mod_perl has logic to merge per-server and per-directory PerlSetVar attributes, doing it itself instead of relying on Apache. while this is good under most circumstances, I think you've uncovered someplace where it doesn't work as well as you'd like.
and this does not work either:
<Perl>
push @{$Location{"/"}->{PerlSetVar}}, ["CFG", "/path/to/file"];
$PerlRequire = "startup.pl";
</Perl>
It seems like this should work, right?
what may be happening is that your dynamic configuration may be putting your PerlSetVar into a per-directory scope instead of a per-server scope, since your config is now in a <Perl> section. meaning, Apache->server->dir_config is (rightfully) empty because now your configuration is in Apache->request->dir_config. of course, you can't get at $r->dir_config at startup, so you're pretty much SOL.
try looking at $r->dir_config('CFG') in a request and see if your value is there. if it is, then I guess my theory is right, and there is little that can be done about it.
HTH
--Geoff