perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Moyer <>
Subject Re: Apache2::CmdParms usage during server startup
Date Tue, 04 Jul 2006 19:47:34 GMT
<late followup>

Geoffrey Young wrote:
> Fred Moyer wrote:
>>>Here's the code I'm using.  I'm guessing that get_config() may not
>>>return what I'm looking for during startup since it functions properly
>>>at runtime.  Any ideas?  $pkg_global will be a template object, which
>>>is why I want to construct it during startup.  I can make a new object
>>>with each handler call but I was hoping to avoid that.
>>Aha - simple solution is use the first instance of get_config() in the
>>handler and cache it. 
> or create the various CREATE() and MERGE() subroutines, and use those to
> govern singleton creation.

I'm not using any vhosts so from my understanding I don't need MERGE(). 
  So I have been able to successfully implement the SERVER_CREATE sub to 
create a singleton, but I still need to access a command directive for 
the singleton creation.  I tried this approach which didn't succeed.

I'm basically trying to get the value of a command directive in the 
global server part of httpd.conf during startup so can do fun stuff with 
it in rather than at runtime.


MyappRoot = '/path/to/myapproot';

package My::Config;


Apache2::Module::add(__PACKAGE__, ( { name => 'myapproot', ... });

   my ($class, $parm) = @_;

   my $cfg = Apache2::Module::get_config(__PACKAGE__, 
Apache2::ServerUtil->server);  # $cfg is undefined <<-----

   return bless { myapproot => $cfg->{_myapproot}};

sub MyappRoot {
   my ($cfg, $parms, $arg) = @_;
   $cfg->{_myapproot} = $arg;

View raw message