Re: [MP2] Accessing custom config directives from an PostConfig handler

[prev] [thread] [next] [Date index for 2005/05/23]

From: Stas Bekman
Subject: Re: [MP2] Accessing custom config directives from an PostConfig handler
Date: 17:54 on 23 May 2005
Geoffrey Young wrote:
> 
> Torsten Foertsch wrote:
> 
>>Hi,
>>
>>I have created my own configuration directives with Apache2::Module::add. How 
>>can I access the values from an PostConfig handler?
>>
>>I have got it working with the main server. But if my directives are inside a 
>>VirtualHost they are not accessible.
> 
> 
>>Apache2::ServerUtil->server
> 
> 
> IIRC the issue is that in post-config you aren't actually attached to a
> server, so you need to iterate the list of servers and find the one (by name
> I guess) that you are intersted in.  IIRC there were some examples in the
> archives of how to do this.  at the very least you can check out
> mod_rewrite, which I belive does exactly that (in C though :)

It's documented:
http://perl.apache.org/docs/2.0/api/Apache2/ServerRec.html#C_next_
http://perl.apache.org/docs/2.0/user/handlers/server.html#C_PerlOpenLogsHandler_

Torsten, if you think we could add a xref to this technique elsewhere that 
it'd make it easier to find it, please suggest. I agree that it's not easy 
to do now, unless you know things well.

e.g. may be a xref from:
http://perl.apache.org/docs/2.0/user/handlers/server.html#C_PerlPostConfigHandler_
to:
http://perl.apache.org/docs/2.0/user/handlers/server.html#C_PerlOpenLogsHandler_
will help? e.g.:

If you want to traverse the configured virtual hosts, you can accomplish 
that using a simple loop (see PerlOpenLogsHandler for an example)


        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: [MP2] Accessing custom config directives from an PostConfig handler
Stas Bekman 17:54 on 23 May 2005

Generated at 20:12 on 05 Jun 2005 by mariachi v0.52