perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip M. Gollucci" <>
Subject Re: Reading custom configuration parameters
Date Thu, 28 Sep 2006 22:28:49 GMT
Erik Norgaard wrote:
> Philip M. Gollucci wrote:
>> Erik Norgaard wrote:
>>> Hi:
>>> I have successfully created a module that declares some configuration 
>>> parameters which should be available to the handler: dbDriver, 
>>> dbHost, dbName, dbUser and dbPassword. Or so I think, I followed this 
>>> guide:
>> This section of it doesn't answer that for you ?

>> The simple answer is try it :)
> The yet simpler ? :) Well, what confuses me is the merging example in 
> the end of the text. Anyway, the text you refer to tells how I can get 
> global/serverwide parameters, but I don't see any mention of whether or 
> not parameters defined for a different virtual host is possible. I 
> prefer not for security.
I believe you can get to anything:

If a request is made to a resource inside a virtual host, $srv_cfg will contain the object
of the virtual host's server.
   my $srv_cfg = Apache2::Module::get_config('MyApache2::MyParameters', $s);

To reach the main server's configuration object use:
   use Apache2::Module ();
   use Apache2::ServerRec ();
   use Apache2::ServerUtil ();
   if ($s->is_virtual) {
       my $base_srv_cfg = Apache2::Module::get_config('MyApache2::MyParameters',
       print $base_srv_cfg->{name};

However, I think you can still get to anything you want:

   my $tree = Apache2::Directive::conftree();

by traversing this far enough down.  (see t/response/TestApache/

Philip M. Gollucci ( 323.219.4708
Consultant /
Senior Software Engineer - TicketMaster -
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

When I call your name, Girl, it starts to flame
Burning in my heart, Tearing it all apart..
No matter how I try My love I cannot hide....

View raw message