<late followup>
Philip M. Gollucci wrote:
Fred Moyer wrote:
Fred Moyer wrote:
Aha - simple solution is use the first instance of get_config() in the
handler and cache it. Sorry for the noise - got caught up in 'why
isnt it working when maybe it should'. Still a bit curious why it
doesn't work with a ServerUtil->server object during startup, should
any one familiar with the details care to indulge me I would be
delighted.
use Apache2::ServerUtil;
my $s = Apache2::ServerUtil->server;
This value takes the global server_rec object which btw is not thread safe
according to mod_perl.h.
This value is not yet set in startup.pl in the 'Config' phases.
Do you mean $s is not set? I can successfully call methods on it that
output httpd.conf settings like $s->keep_alive.
I've had the chance to hack on this again and I think I see what you are
saying here. As a followup, basically what I'm trying to do is define a
command parameter such as
MyappRoot /path/to/myroot
in the global server config and then
PerlConfigRequire '/path/to/app/lib/My/Config.pm'
which builds the command parameter like
Apache2::Module::add( { name => 'MyappRoot', ... } );
sub MyappRoot {
my ($cfg, $parm, $arg) = @_;
$cfg->{_myapproot} = $arg;
}
so that in startup.pl I can grab MyappRoot like so:
use Apache2::Module ();
my $cfg = Apache2::Module::get_config('My::Config', Apache2::ServerUtil);
my $approot = $cfg->{_myapproot};
and then do some initialization using $approot, and possibly other
command directives, so that all my configuration is set by command
directives. See the additional email on this thread I just responded to
for the other approach I tried.
After all, what server would you be taking about ?
The parent, the child ?
The parent I believe, since this is during startup.
You might try set PerlTrace i
if you want to see some debugging assuming you got MP_TRACE=1 in your
Makefile.pl line one way or another.
Checkout src/modules/perl/modperl.c and look for
modperl_global_get_server_rec
I'll check these out. Thanks for the continued help.