Apache::OutputChain was written as a way of exploring the possibilities of stacked handlers in mod_perl. It ties STDOUT to an object which catches the output and makes it easy to build a chain of modules that work on output data stream.
Examples of modules that are build on this idea are Apache:
SIChain, Apache::GzipChain and Apache::EmbperlChain -- the first processes the SSI's in the stream, the second compresses the output on the fly, the last adds Embperl processing.
The syntax goes like this:
<Files *.html>
SetHandler perl-script
PerlHandler Apache::OutputChain Apache:
SIChain Apache:
assHtml
</Files>
The modules are listed in the reverse order of their execution -- here the Apache:
assHtml module simply picks a file's content and sends it to STDOUT, then it's processed by Apache:
SIChain, which sends its output to STDOUT again. Then it's processed by Apache::OutputChain, which finally sends the result to the browser.
An alternative to this approach is Apache::Filter, which has a more natural forward configuration order and is easier to interface with other modules.
It works with Apache::Registry as well, for example:
Alias /foo /home/httpd/perl/foo
<Location /foo>
SetHandler "perl-script"
Options +ExecCGI
PerlHandler Apache::OutputChain Apache::GzipChain Apache::Registry
</Location>
It's really a regular Apache::Registry setup, except for the added modules in the PerlHandler line.
(Apache::GzipChain allows to compress the output on the fly.)