mod_perl Pocket Reference
By Andrew Ford
Writing Apache Modules with Perl and C
By Lincoln Stein, Doug MacEachern
Embedding Perl in HTML with Mason
By Dave Rolsky, Ken Williams
mod_perl2 User's Guide
By Stas Bekman, Jim Brandt
By Stas Bekman, Eric Cholet
The mod_perl Developer's Cookbook
By Geoffrey Young, Paul Lindner, Randy Kobes
Here is the documentation for the whole API provided with the mod_perl
distribution, ie. of various Apache:: modules you will need to use.
Part I: Access to the Apache API
- Apache - Perl interface to the Apache server API
- This module provides a Perl interface the Apache API. It is here
mainly for mod_perl, but may be used for other Apache modules that
wish to embed a Perl interpreter. We suggest that you also consult
the description of the Apache C API at http://httpd.apache.org/docs/ .
- Apache::Constants - Constants defined in apache header files
- Server constants used by apache modules are defined in
httpd.h and other header files, this module gives Perl access
to those constants.
- Apache::Options - OPT_* defines from httpd_core.h
Apache::Options module will export the following bitmask
- Apache::Table - Perl interface to the Apache table structure
- This module provides tied interfaces to Apache data structures.
- Apache::File - advanced functions for manipulating files at the server side
Apache::File does two things: it provides an object-oriented
interface to filehandles similar to Perl's standard
class. While the
Apache::File module does not provide all the
IO::File, its methods are approximately twice as
fast as the equivalent
IO::File methods. Secondly, when you use
Apache::File, it adds several new methods to the
which provide support for handling files under the
- Apache::Log - Interface to Apache logging
Apache::Log module provides an interface to Apache's
ap_log_error and ap_log_rerror routines.
- Apache::URI - URI component parsing and unparsing
- This module provides an interface to the Apache util_uri module and
the uri_components structure.
- Apache::Util - Interface to Apache C util functions
- This module provides a Perl interface to some of the C utility
functions available in Apache. The same functionality is avaliable in
libwww-perl, but the C versions are faster:
Part II: Run CGI scripts under mod_perl
- Apache::Include - Utilities for mod_perl/mod_include integration
Apache::Include module provides a handler, making it simple to
Apache::Registry scripts with the mod_include perl
- Apache::Registry - Run unaltered CGI scrips under mod_perl
Apache::Registry is the Apache module allowing you to run CGI
scripts very fast under mod_perl, by compiling all scripts once and
then caching them in memory.
- Apache::PerlRun - Run unaltered CGI scripts under mod_perl
- This module's
handler emulates the CGI environment, allowing
programmers to write scripts that run under CGI or mod_perl without
does not cache the script inside of a subroutine. Scripts will be
"compiled" every request. After the script has run, it's namespace is
flushed of all variables and subroutines.
Part III: Development/Debugging help
- Apache::RegistryLoader - Compile Apache::Registry scripts at server startup
- This modules allows compilation of
Apache::Registry scripts at
- Apache::StatINC - Reload %INC files when updated on disk
- When Perl pulls a file via
require, it stores the filename in the
%INC. The next time Perl tries to
require the same
file, it sees the file in
%INC and does not reload from disk. This
module's handler iterates over
%INC and reloads the file if it has
changed on disk.
- Apache::test - Facilitates testing of Apache::* modules
- This module helps authors of
Apache::* modules write test suites
that can query an actual running Apache server with mod_perl and their
modules loaded into it.
- Apache::Symdump - Symbol table snapshots
Apache::Symdump will record snapshots of the Perl symbol table for you to look at later.
- Apache::src - Methods for locating and parsing bits of Apache source code
- This module provides methods for locating and parsing bits of Apache
- Apache::Leak - Module for tracking memory leaks in mod_perl code
Apache::Leak is a module built to track memory leaks in mod_perl
- Apache::FakeRequest - fake request object for debugging
Apache::FakeRequest is used to set up an empty Apache request
object that can be used for debugging.
- Apache::Debug - Utilities for debugging embedded perl code
- This module sends what may be helpful debugging info to the client
rather that the error log.
- Apache::Symbol - Things for symbol things
Apache::Symbol helps mod_perl users avoid Perl warnings related
with redefined constant functions.
Part IV: Apache configuration
- Apache::SIG - Override apache signal handlers with Perl's
- When a client drops a connection and apache is in the middle of a
write, a timeout will occur and httpd sends a
SIGPIPE handler is used, Perl may be left in the middle of
it's eval context, causing bizarre errors during subsequent requests
are handled by that child. When
Apache::SIG is used, it installs a
SIGPIPE handler which rewinds the context to make sure
Perl is back to normal state, preventing these bizarre errors.
- Apache::PerlSections - Utilities for work with Perl sections
- It is possible to configure you server entirely in Perl using
<Perl> sections in httpd.conf. This module is here to
help you with such a task.
- Apache::httpd_conf - Generate an httpd.conf file
- The Apache::httpd_conf module will generate a tiny httpd.conf file,
which pulls itself back in via a
Part V: Server Maintenance
- Apache::Status - Embedded interpreter status information
Apache::Status module provides some information about the
status of the Perl interpreter embedded in the server.
- Apache::Resource - Limit resources used by httpd children
Apache::Resource uses the
BSD::Resource module, which
uses the C function
setrlimit to set limits on
system resources such as memory and cpu usage.
- Apache::SizeLimit - Because size does matter.
- This module allows you to kill off Apache httpd processes if they grow
See perldoc.perl.org for
documentation of the rest of the