httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <>
Subject Re: <PERL>...</PERL> in .conf files
Date Fri, 05 Sep 1997 00:33:54 GMT (Rasmus Lerdorf) wrote:

> I poked around in the mod_perl sources but got a tad lost.  Could someone
> here post a short point-form summary of where the hooks are to allow a
> parser to parse things in the Apache .conf files at startup?  
> With the cool new PHP3 parser, I am looking at letting people put PHP
> scripts in the Apache conf files.

What Dean said explains why it's hard to follow, no clean hooks yet,
so no short summary :-/  The best I can give is a quick explain how
<Perl> works:

The perl_section() functions reads in the code from <Perl></Perl>,
evals it inside the Perl package ApacheReadConfig.
Then it walks the ApacheReadConfig symbol table, looking at global
variables, if we see a $scalar which is not a reference, the variable
name and value are simply passed to Apache's handle_command().  If
it's a @array, we join into a single-space delimited string and pass
to handle_command().  Not too bad.  Sections like 
<Location>, <VirtualHost>, <Files>, etc., are stored in a %hash of the
same name.  You'll see in http_core.c, the functions that deal with
sections, urlsection(), virtualhost_section(), etc.  In mod_perl's
config.c you'll see a perl_ counterpart function for each which deal
with the Perl %hash sections.  This is where the duplicate code is.
Other than that, we use array and hash references to deal with things
like TAKE2, TAKE3, etc., nested sections, this and that.  I don't know
anything about php internals, so I'm not sure if it could follow this
same stragedy. We should really find the time to define and implement
a clean config interface.  


View raw message