Andy Lester wrote: > > How can I get mod_perl to handle all Apache output, whether or not it > originates with mod_perl? > > I'm writing a module that needs to analyze all output generated by Apache. > That's easy enough with stacked handlers, but I'm goofing something up > with, say, static HTML. > > If I do this: > > <Location /test> > PerlHandler MyFilter > </Location> > > Then static HTML gets served up OK, but MyFilter doesn't seem to get > called. Or is it, and I'm screwing something up in the filter? > > And of course if I do this: > > <Location /test> > SetHandler perl-script > PerlHandler MyFilter > </Location> > > Then I get no output because the .html files that I'm trying to serve up > out of /test aren't Perl. > > Pointers please? I've got both the Cookbook and the Eagle book if you > want to just point to a page. >
ok, SetHandler sets a content handler for a given <Location> - it supersededs everything else. unlike with normal Apache, mod_perl needs two things in order for your handler to be called: the content hander to be perl-script (for Apache) and the name of your handler with PerlHandler (for mod_perl) you probably want to do something with AddHandler instead of SetHandler AddHandler .pl perl-script you can also use <Files> sections instead of <Location> see the later part of Recipe 14.2 gets into this somewhat. Apache::MIMEMapper might also be of help since, among other things, integrates with Apache::Filter easily... HTH --Geoff