Author image Ken Williams
and 1 contributors


Apache::PerlRunFilter - run Perl scripts in an Apache::Filter chain


 #in httpd.conf

 PerlModule Apache::PerlRunFilter

 # Run the output of scripts through Apache::SSI
 <Files ~ "\.pl$">
  SetHandler perl-script
  PerlHandler Apache::PerlRunFilter Apache::SSI
  PerlSetVar Filter on

 # Generate some Perl code using templates, then execute it
 <Files ~ "\.tmpl$">
  SetHandler perl-script
  PerlHandler YourModule::GenCode Apache::PerlRunFilter
  PerlSetVar Filter on


This module is a subclass of Apache::PerlRun, and contains all of its functionality. The only difference between the two is that this module can be used in conjunction with the Apache::Filter module, whereas Apache::PerlRun cannot.

It only takes a tiny little bit of code to make the filtering stuff work, so perhaps it would be more appropriate for the code to be integrated right into Apache::PerlRun. As it stands, I've had to duplicate a bunch of PerlRun's code here (in the handler routine), so bug fixes & feature changes must be made both places.


Note that this is not an exact replacement for Apache::Registry - it doesn't do any of the code-caching stuff that Registry does. It shouldn't be too hard a task, but for now Registry is still based on old code, and Doug's plan is to make future versions of Registry by subclassing PerlRun (see Apache::RegistryNG). Since this is the case, I figured I'd hold off on doing any Registry work until things have moved forward a bit.


perl(1), mod_perl(3), Apache::PerlRun(3)


Ken Williams <>