perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Foertsch <>
Subject Re: [MP2] Accessing custom config directives from an PostConfig handler
Date Mon, 23 May 2005 20:19:06 GMT
On Monday 23 May 2005 19:54, Stas Bekman wrote:
> 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:
> 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:
>andler_ to:
>dler_ 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)

I already had had a loop

for( my $srv=Apache2::ServerUtil->server; $srv; $srv=$srv->next ) {...}

But in the same function I had a variable named $s that also was a server 
object. Now due to a simple spelling mistake inside the loop I had looked 5 
times at $s instead of $srv wondering why my configuration was undef all the 
time, ;-).

I think a document explaining the fundamental Apache/mod_perl data structures 
in terms of C _and_ mod_perl would be good. Then it can be linked from the 
rest of the docs. BTW, is there somewhere a good Apache API documentation? 
All my knowledge about it comes from looking at mod_perl, mod_dir, 
mod_rewrite, mod_ssl, etc.


View raw message