You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Robin Berjon <ro...@knowscape.com> on 2000/12/07 04:55:47 UTC

source filters in httpd.conf

Hi,

I've been trying to use Perl source filters in httpd.conf but to no avail.
The archives contain some information on using source filters in modules or
registry scripts, but I couldn't find anything about using a filter with
either use MyFilter in a <Perl> section or PerlModule MyFilter. I'm running
1.3.14 with 1.24_02 and I've built with EVERYTHING=1.

The following Perl script works perfectly well:

use MyConf::TestMe;
use Apache::FilterConf;
PerlFilterConfSetup MyConf::TestMe TestMe line
PerlFilterConfSetup MyConf::TestMe TestMeToo block
TestMe as a line
<TestMeToo as a block>
with some content
</TestMeToo>

However all variations that I've tried in httpd.conf fail, even if I put it
all inside a <Perl> section.

What I'm trying to achieve is to make the creation of custom configuration
directives easier, more flexible, and full Perl (no XS). In the above Perl
snippet everything after "use Apache::FilterConf;" is filtered by a Perl
routine. The PerlFilterConfSetup directives tell Apache::FilterConf to
register with itself two directives called TestMe and TestMeToo that are
defined in MyConf::TestMe (that is they have callbacks there). The other
lines are parsed and appropriate callbacks called when the filter finds
defined directives. If it sees a line with a directive that it doesn't know
it simply passes it on using Apache->httpd_conf. Apache never sees the
defined directives (which might lose you some info in mod_info, but that's
a small price) and the callbacks are free to do what they want, parse the
directives whichever way pleases them (they always get the raw text), add
some stuff to the httpd.conf that Apache would see, die on errors, etc...
Not all this is done cleanly yet (I'd like to be sure it's possible before
I polish it) but it would all be possible if I could get filters to work in
httpd.conf.

Such a module would be imho very nice to have :) I guess that there is
something in modperl interfering with filters that prevents the stream from
going through the source filter (the filter() sub never gets called) but I
don't know enough about modperl's internal to see what it is and to provide
a patch (given that it's possible). So if anyone can provide me with a
solution to make it work I'd be very happy to hear about it.

Thanks,

-- robin b.
As a computer, I find your faith in technology amusing.