Geoffrey Young wrote:
I'm just trying to write code in a config reader that reads server->dir_config when it's loaded into apache, and request->dir_config when it is called during requests.all your other questions aside for the moment, I don't understand from where you might be trying to do that. My::Package; # this code executes on server startup when using PerlModule sub handler { # this code executes on each request } if you're worried about the server part being called when the module is being loaded initially during a request (say, if someone didn't use PerlModule) then something like this might work my $r_or_s = eval { Apache2::RequestUtil->request } || Apache2::ServerUtil->server; my $value = $r_or_s->dir_config($key) || $ENV{$key} || $default; or somesuch.
No love. This block segfaults my apache2/mp2:
if (exists $ENV{MOD_PERL_API_VERSION} && $ENV{MOD_PERL_API_VERSION} == 2) { require Apache2::RequestRec; require Apache2::RequestUtil; require Apache2::RequestIO; require Apache2::ServerUtil; my $c = eval {Apache2::RequestUtil->request} || Apache2::ServerUtil->server; if ($c) { $value = $c->dir_config($key) || $ENV{$key} || $default; }; } elsif ($ENV{MOD_PERL}) {
Commenting out the eval line lets the server run fine and dandy. :-( -=Chris
smime.p7s
Description: S/MIME Cryptographic Signature