Practical mod_perlPractical mod_perlSearch this book

B.11. Generic Content-Generation Modules

These modules extend mod_perl functionality during the content-generation phase. Some of them can also be used during earlier phases.

B.11.1. Apache::Registry and Apache::PerlRun

These two modules allow mod_cgi Perl scripts to run unaltered under mod_perl. They are covered throughout the book, mainly in Chapter 6 and Chapter 13.

See also the related Apache::RegistryNG and Apache::RegistryBB modules.

Supplied with the mod_perl distribution. See the module manpage for more information.

B.11.2. Apache::RegistryNG—Apache::Registry New Generation

Apache::RegistryNG is almost the same as Apache::Registry, except that it uses filenames instead of URIs for namespaces. It also uses an object-oriented interface.

PerlModule Apache::RegistryNG
<Location /perl>
  SetHandler perl-script
  PerlHandler Apache::RegistryNG->handler
</Location>

The usage is just the same as Apache::Registry.

Apache::RegistryNG inherits from Apache::PerlRun, but the handler( ) is overriden. Apart from the handler( ), the rest of Apache::PerlRun contains all the functionality of Apache::Registry, broken down into several subclassable methods. These methods are used by Apache::RegistryNG to implement the exact same functionality as Apache::Registry, using the Apache::PerlRun methods.

There is no compelling reason to use Apache::RegistryNG over Apache::Registry, unless you want to add to or change the functionality of the existing Registry.pm. For example, Apache::RegistryBB is another subclass that skips the stat( ) call, Option +ExecCGI, and other checks performed by Apache::Registry on each request.

Supplied with the mod_perl distribution. See the module manpage for more information.

B.11.3. Apache::RegistryBB—Apache::Registry Bare Bones

This works just like Apache::Registry, but it does not test the x bit (-x file test for executable mode), compiles the file only once (no stat( ) call is made for each request), skips the OPT_EXECCGI checks, and does not chdir( ) into the script's parent directory. It uses the object-oriented interface.

Configuration:

PerlModule Apache::RegistryBB
<Location /perl>
    SetHandler perl-script
    PerlHandler Apache::RegistryBB->handler
</Location>

The usage is just the same as Apache::Registry.

Supplied with the mod_perl distribution. See the module manpage for more information.

B.11.4. Apache::Request (libapreq)—Generic Apache Request Library

This package contains modules for manipulating client request data via the Apache API with Perl and C. Functionality includes:

The Perl modules are simply a thin XS layer on top of libapreq, making them a lighter and faster alternative to CGI.pm and CGI::Cookie. See the Apache::Request and Apache::Cookie documentation for more details and eg/perl/ for examples.

Apache::Request and libapreq are tied tightly to the Apache API, to which there is no access in a process running under mod_cgi.

This module is mentioned in Chapter 6 and Chapter 13.

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

B.11.5. Apache::Dispatch—Call PerlHandlers with the Ease of Registry Scripts

Apache::Dispatch translates $r->uri into a class and method and runs it as a PerlHandler. Basically, this allows you to call PerlHandlers as you would Registry scripts, without having to load your httpd.conf file with a lot of <Location > tags.

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



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.