O'Reilly logo

Practical mod_perl by Eric Cholet, Stas Bekman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Application-Specific Content-Generation Modules

Apache::AutoIndex—Perl Replacement for the mod_autoindex and mod_dir Apache Modules

This module can completely replace the mod_dir and mod_autoindex standard directory-handling modules shipped with Apache.

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

Apache::WAP::AutoIndex—WAP Demonstration Module

This is a simple module to demonstrate the use of CGI::WML to create a WML (wireless) file browser using mod_perl. It was written to accompany an article in the Perl Journal (Issue 20).

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

Apache::WAP::MailPeek—Demonstrate Use of WML Delivery

This is a simple module to demonstrate the use of delivery of WML with mod_perl. It was written to accompany an article in the Perl Journal (Issue number 20).

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

Apache::Archive—Expose Archive Files Through the Apache Web Server

Apache::Archive is a mod_perl extension that allows the Apache HTTP server to expose .tar and .tar.gz archives on the fly. When a client requests such an archive file, the server will return a page displaying information about the file that allows the user to view or download individual files from within the archive.

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

Apache::Gateway—Implement a Gateway

The Apache::Gateway module implements a gateway using LWP with assorted optional features. From the HTTP/1.1 draft, a gateway is:

[a] server which acts as an intermediary for some other server.
Unlike a proxy, a gateway receives requests as if it were the origin
server for the requested resource; the requesting client may not be
aware that it is communicating with a gateway.

Features:

  • Standard gateway features implemented using LWP

  • Automatic failover with mirrored instances

  • Multiplexing

  • Pattern-dependent gatewaying

  • FTP directory gatewaying

  • Timestamp correction

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

Apache::NNTPGateway—NNTP Interface for a mod_perl-Enabled Apache Web Server.

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

Apache::PrettyPerl—Syntax Highlighting for Perl Files

An Apache mod_perl PerlHandler that outputs color syntax-highlighted Perl files in the client's browser.

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

Apache::PrettyText—Reformat .txt Files for Client Display

Dynamically formats .txt files so they look nicer in the client's browser.

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

Apache::RandomLocation—Random File Display

Given a list of locations in ConfigFile, this module will instruct the browser to redirect to one of them. The locations in ConfigFile are listed one per line, with lines beginning with # being ignored. How the redirection is handled depends on the variable Type.

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

Apache::Stage—Manage a Staging Directory

A staging directory is a place where the author of an HTML document checks the look and feel of the document before it's uploaded to the final location. A staging place doesn't need to be a separate server or a mirror of the "real" tree, or even a tree of symbolic links. A sparse directory tree that holds nothing but the staged files will do.

Apache::Stage implements a staging directory that needs a minimum of space. By default, the path for the per-user staging directory is hardcoded as:

/STAGE/any-user-name

The code respects proper internal and external redirects for any documents that are not in the staging directory tree. This means that all graphics are displayed as they will be when the staged files have been published. The following table provides an example structure:

Location           Redirect-to Comment
------------------ ----------- ---------------------------
/STAGE/u1/         /           Homepage. Internal Redirect.
/STAGE/u2/dir1     /dir1/      Really /dir1/index.html
/STAGE/u3/dir2     /dir2/      Directory has no index.html
                               Options Indexes is off, thus
                               "Forbidden"
/STAGE/u4/dir2/foo /dir2/foo   Internal redirect.
/STAGE/u5/bar      -           Exists really, no redirect
                               necessary
/STAGE/u6          -           Fails unless location exists

The entries described in SYNOPSIS in access.conf or an equivalent place define the name of the staging directory, the name of an internal location that catches the exception when a document is not in the staging directory, and the regular expression that transforms the staging URI into the corresponding public URI.

With this setup only ErrorDocuments 403 and 404 will be served by Apache::Stage. If you need coexistence with different ErrorDocument handlers, you will either have to disable them for /STAGE or integrate the code of Apache::Stage into an if/else branch based on the path.

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

Apache::Roaming—A mod_perl Handler for Roaming Profiles

With Apache::Roaming you can use your Apache web server as a Netscape Roaming Access server. This allows users to store Netscape Communicator 4.5+ preferences, bookmarks, address books, cookies, etc., on the server so that they can use (and update) the same settings from any Netscape Communicator 4.5+ browser that can access the server.

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

Apache::Backhand—Write mod_backhand Functions in Perl

Apache::Backhand ties mod_perl together with mod_backhand, in two major ways. First, the Apache::Backhand module itself provides access to the global and shared state information provided by mod_backhand (most notably server stats). Second, the byPerl C function (which is not part of the Apache::Backhand module but is distributed with it) allows you to write candidacy functions in Perl.

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required