Providing Content via Apache::Filter

Filter chains are made available by adding the Apache::Filter extension to mod_perl via a PerlModule configuration directive to your httpd.conf file. Then, to set the filter chain for a specific resource, you set mod_perl as the main Apache handler and pass a whitespace-separated list of Perl classes to the PerlHandler directive. That done, the output of the first Perl content handler is sent as the input to the next, and so on (similar to AxKit’s own style transformation chains):

PerlModule Apache::Filter

<Location /path/to/my/app>
  SetHandler perl-script
  PerlSetVar Filter On
  PerlHandler Filter1 Filter2 Filter3

AxKit’s standard distribution includes a simple, but powerful, Provider class, Apache::AxKit::Provider::Filter, that uses the Apache::Filter interface to capture the result of one or more mod_perl content handlers for further processing inside AxKit. This means that any Apache::Filter-aware handler can be used to provide XML content to AxKit.


AxKit requires that data passed in through the ContentProvider interface be a well-formed XML document. That does not mean that the source of that content must be XML. As long as the returned result is well-formed XML, you are free to use whatever means necessary to generate it. AxKit does not care how the XML gets there, only that it does.


First, let’s examine how you can use a basic Perl CGI script to generate XML that is transformed and delivered by AxKit. The script itself is quite ...

Get XML Publishing with AxKit now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.