By Stas Bekman, Eric Cholet
mod_perl2 User's Guide
By Stas Bekman, Jim Brandt
The Apache::, APR:: and ModPerl:: namespaces APIs for mod_perl 2.0
Apache2::CmdParmsprovides the Perl API for Apache command parameters object.
Apache2::Commandprovides the Perl API for accessing Apache module command information
Apache2::RequestRecprovides the Perl API for Apache connection record object.
Apache2::ConnectionUtilprovides the Apache connection record object utilities API.
Apache2::Directiveprovides the Perl API for manipulating the Apache configuration tree
Apache2::Filterprovides Perl API for Apache 2.0 filtering framework.
Apache2::FilterRecprovides an access to the filter record structure.
Apache2::HookRunexposes parts of the Apache HTTP protocol implementation, responsible for invoking callbacks for each HTTP Request cycle phase.
Apache2::Logprovides the Perl API for Apache logging methods.
Apache2::MPMprovides the Perl API for accessing Apache MPM information.
Apache2::Moduleprovides the Perl API for creating and working with Apache modules
</Perl>sections, it is possible to configure your server entirely in Perl.
Apache2::Processprovides the API for the Apache process object, which you can retrieve with
Apache2::RequestIOprovides the API to perform IO on the Apache request object.
Apache2::RequestRecprovides the Perl API for Apache request_rec object.
Apache2::RequestUtilprovides the Apache request object utilities API.
Apache2::Responseprovides the Apache request object utilities API for dealing with HTTP response generation process.
Apache2::ServerRecprovides the Perl API for Apache server_rec object.
Apache2::ServerUtilprovides the Apache server object utilities API.
Apache2::SubProcessprovides the Perl API for running and communicating with processes spawned from mod_perl handlers.
Apache2::SubRequestcontains API for creating and running of Apache sub-requests.
APR::URIprovides a generic API to dissect, adjust and put together any given URI string,
Apache2::URIprovides an API specific to Apache, by taking the information directly from the
$robject. Therefore when manipulating the URI of the current HTTP request usually methods from both classes are used.
APR::Base64provides the access to APR's base64 encoding and decoding API.
APR::Brigadeallows you to create, manipulate and delete APR bucket brigades.
APR::Bucketallows you to create, manipulate and delete APR buckets.
APR::BucketAllocis used for bucket allocation.
APR::BucketTypeallows you to query bucket object type properties.
APR::Socketprovides the Perl interface to APR date manipulating functions.
APR::Errorhandles APR/Apache/mod_perl exceptions for you, while leaving you in control.
stat()call, but you will want to use this module's API to query an already
stat()'edfilehandle to avoid an extra system call or to query attributes specific to APR file handles.
APR::IpSubnetobject represents a range of IP addresses (IPv4/IPv6). A socket connection can be matched against this range to test whether the IP it's coming from is inside or outside of this range.
APR::OSprovides the Perl interface to platform-specific APR API.
APR::PerlIOimplements a Perl IO layer using APR's file manipulation API internally.
APR::Poolprovides an access to APR pools, which are used for an easy memory management.
APR::SockAddrprovides an access to a socket address structure fields.
APR::Socketprovides the Perl interface to APR sockets.
APR::Stringprovides strings manipulation API.
APR::Tableallows its users to manipulate opaque string-content tables.
APR::ThreadMutexinterfaces APR thread mutexes.
APR::ThreadRWLockinterfaces APR thread read/write locks.
APR::URIallows you to parse URI strings, manipulate each of the URI elements and deparse them back into URIs.
APR::UUIDis used to get and manipulate random UUIDs.
ModPerl::Globalprovides an API to manipulate special perl lists. At the moment only the
ENDblocks list is supported.
ModPerl::MethodLookupprovides the Perl API for finding module names which contain methods in question and other helper functions, to find out out what methods defined by some module, what methods can be called on a given object, etc.
ModPerl::MMis a "subclass" of
ExtUtils::MakeMakerfor mod_perl 2.0, to a degree of sub-classability of
ModPerl::PerlRunPreforkshould be used by those who run only under prefork MPM.
http://example.com/perl/test.plwill be compiled as the body of a Perl subroutine and executed. Each child process will compile the subroutine once and store it in memory. It will recompile it whenever the file (e.g. test.pl in our example) is updated on disk. Think of it as an object oriented server with each script implementing a class loaded at runtime.
ModPerl::RegistryBBis similar to
ModPerl::Registry, but does the bare minimum (mnemonic: BB = Bare Bones) to compile a script file once and run it many times, in order to get the maximum performance. Whereas
ModPerl::Registrydoes various checks, which add a slight overhead to response times.
ModPerl::RegistryCookeris used to create flexible and overridable registry modules which emulate mod_cgi for Perl scripts. The concepts are discussed in the manpage of the following modules:
ModPerl::RegistryCooker, at server startup. The script's handler routine is compiled by the parent server, of which children get a copy and thus saves some memory by initially sharing the compiled copy with the parent and saving the overhead of script's compilation on the first request in every httpd instance.
ModPerl::Utilprovides mod_perl utilities API.
Apache2::compatprovides mod_perl 1.0 compatibility layer and can be used to smooth the transition process to mod_perl 2.0.
Apache2::portinghelps to port mod_perl 1.0 code to run under mod_perl 2.0. It doesn't provide any back-compatibility functionality, however it knows to trap methods calls that are no longer in the mod_perl 2.0 API and tell what should be used instead if at all. If you attempts to use mod_perl 2.0 methods without first loading the modules that contain them, it will tell you which modules you need to load. Finally if your code tries to load modules that no longer exist in mod_perl 2.0 it'll also tell you what are the modules that should be used instead.
Apache2::Reloadreloads modules that change on the disk.
BSD::Resourcemodule, which uses the C function
setrlimitto set limits on system resources such as memory and cpu usage.
Apache2::Statusmodule provides some information about the status of the Perl interpreter embedded in the server.
ModPerl::BuildMMis a "subclass" of
ModPerl::MMused for building mod_perl 2.0. Refer to