books
Free Books / Computers / Practical mod_perl /

previous page: B.14.9. Template Toolkit—Template Processing System
  
page up: Practical mod_perl | by Stas Bekman and Eric Cholet
  
next page: B.15.2. Apache::Clean—mod_perl Interface Into HTML::Clean

B.15.1. Apache::OutputChain—Chain Stacked Perl Handlers




Description

This section is from the "Practical mod_perl" book, by Stas Bekman and Eric Cholet. Also available from Amazon: Practical mod_perl

Apache::OutputChain was written to explore the possibilities of stacked handlers in mod_perl. It ties STDOUT to an object that catches the output and makes it easy to build a chain of modules that work on the output data stream.

Examples of modules that are built using this idea are Apache::SSIChain, Apache::GzipChain, and Apache::EmbperlChain—the first processes the SSIs in the stream, the second compresses the output on the fly, and the last provides Embperl processing.

The syntax is like this:

<Files *.html>
    SetHandler perl-script
    PerlHandler Apache::OutputChain Apache::SSIChain Apache::PassHtml
</Files>

The modules are listed in reverse order of their execution—here the Apache::PassHtml module simply collects a file's content and sends it to STDOUT, and then it's processed by Apache::SSIChain, 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.

Apache::OutputChain 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::Registrysetup, except for the added modules in the PerlHandler line.

Available from CPAN. See the module manpage for more information.

 

Continue to:

  • prev: B.14.9. Template Toolkit—Template Processing System
  • Table of Contents
  • next: B.15.2. Apache::Clean—mod_perl Interface Into HTML::Clean

Books by Stas Bekman:















TOP
previous page: B.14.9. Template Toolkit&#8212;Template Processing System
  
page up: Practical mod_perl | by Stas Bekman and Eric Cholet
  
next page: B.15.2. Apache::Clean&#8212;mod_perl Interface Into HTML::Clean

Topics

  • Animals
  • Architecture
  • Arts
  • Business
  • Computers
  • Crafts
  • Fairy Tales
  • Finance
  • Flora and Plants
  • Cooking
  • Gardening
  • Health and Healing
  • History
  • Home Improvements
  • Languages
  • New Age
  • Novels
  • Real Estate
  • Reference
  • Religion
  • Science
  • Society
  • Sports
  • Travel
  • Outdoors


Search

My Books

Headaches Begone! A Systemic Approach To Healing Your Headaches
Don't Let Your Bike Seat Ruin Your Sex Life Book

Discover

  • Answers FAQ

[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007-2021 StasoSphere.com