Home  |  Reviews  |  Table of Contents  |  Sample Chapters  |  Source Code  |  Authors  |  Errata  |  Resources  |  Contact  Purchase Now 
 Table of Contents


Part I Installation and Configuration

1. Installing mod_perl

    1.1. Unix Binary Installation
    1.2. Windows Binary Installation
    1.3. Mac OS X Binary Installation
    1.4. Building mod_perl on Unix
    1.5. Building mod_perl on Windows
    1.6. Building mod_perl on Mac OS X
    1.7. Building mod_perl as a Shared Library
    1.8. Testing Your Installation
    1.9. Changing Apache Installation Directories
    1.10. Adding mod_perl to an Existing Apache Server
    1.11. Reusing Configuration Directives
    1.12. Re-Creating a mod_perl Installation
    1.13. Distributing mod_perl to Many Machines
    1.14. Inspecting an Existing Server
    1.15. Installing Apache Modules from CPAN
    1.16. Following mod_perl Development
    1.17. Beyond Simple CVS
    1.17. Building mod_perl with Different perls

2. Configuring mod_perl

    2.1. Migrating Legacy CGI Scripts
    2.2. Using Apache::Registry
    2.3. The Script
    2.4. Sharing Script Namespace Under Apache::Registry
    2.5. Pre-Caching Apache::Registry Scripts
    2.6. Populating CGI Environment Variables
    2.7. Setting Other Environment Variables
    2.8. Using Perl Switches
    2.9. BEGIN and END Blocks in
    2.10. Maintaining Your Own Libraries
    2.11. Persistent Database Connections
    2.12. Pre-Spawning Database Connections
    2.13. Nonpersistent Database Connections in a Persistent Environment
    2.14. Setting mod_perl­Only Variables
    2.15. Setting Complex mod_perl Variables
    2.16. Configuring Apache with<Perl> Sections
    2.17. Preserving Order in <Perl> Sections
    2.18. Using Command-Line Switches
    2.19. Running Dual Servers
    2.20. Using mod_proxy to Direct Requests to a mod_perl Server
    2.21. Using mod_proxy_add_forward

Part II The mod_perl API

3. The Apache Request Object

    3.1. The Apache Request Object
    3.2. The HTTP Request Message
    3.3. The Client Request
    3.4. Accessing Client Request Headers
    3.5. Accessing HTML Form Fields
    3.6. Reading POSTed Data Manually
    3.7. Manipulating Cookies
    3.8. Handling File Uploads
    3.9. Setting Server Response Headers
    3.10. Controlling Caching Behavior
    3.11. Sending Server Response Headers
    3.12. Setting the Response Status
    3.13. Setting Error Headers
    3.14. Manipulating Headers with Multiple Like Fields
    3.15 Using Subrequests
    3.16. Setting Headers for Subrequests
    3.17 Short-Circuiting Subrequests
    3.18 Getting or Setting the Request Method
    3.19 Accessing the Request Object from XS

4. Communicating with the Apache Server

    4.1. Accessing the Apache::Server Object
    4.2. Simulating IfModule and IfDefine Directives
    4.3. Accessing ServerRoot and DocumentRoot
    4.4. Writing to the Apache Error Log
    4.5. Accessing the Apache ErrorLog Directive
    4.6. Controlling the LogLevel
    4.7. Accessing the Apache::Connection Object
    4.8. Remote IP Addresses and Hosts
    4.9. Detecting a Broken Connection
    4.10. Terminating an Apache Child Process

5. URI Manipulation

    5.1. Capturing the Request URI
    5.2. Determining the URI <Location>
    5.3. Altering the Request URI
    5.4. Constructing a New URI
    5.5. Escaping Special Characters Within a URI
    5.6. Using the URI to Force a MIME Type
    5.7. Capturing Content from a Subrequest
    5.8. Using Apache::Util Outside mod_perl

6. File Handling

    6.1. Creating Filehandles
    6.2. Creating Temporary Files
    6.3. Sending an Entire File
    6.4. Reading Files into Variables
    6.5. Getting Information About the Requested File
    6.6. Working with Conditional Headers
    6.7. Byteserving and Range Requests
    6.8. Manipulating Date-Based Headers Directly
    6.9. Flushing the Print Buffers
    6.10. Redirecting Output Filehandles

7. Creating Handlers

    7.1. Creating a mod_perl Handler
    7.2. Basic Handler Configuration
    7.3. Adding Handlers On-the-Fly
    7.4. Preparing a Module for Release
    7.5. Creating a Release Tarball
    7.6. Creating a Binary PPM Distribution
    7.7. Writing a Live Server Test Suite
    7.8. Adding Custom Configuration Directives
    7.9. Expanding Custom Directive Prototypes
    7.10. Merging Custom Configuration Directives
    7.11. Overriding Core Directives
    7.12. Adding Unique Server Tokens
    7.13. Releasing a Module to CPAN

8. Interacting with Handlers

    8.1. Recognizing Handler Changes
    8.2. Sharing Data Within a Child Process
    8.3. Creating a Shared Memory Cache
    8.4. Maintaining State
    8.5. Using Internal Redirects
    8.6. Writing Custom ErrorDocuments
    8.7. Resetting Default ErrorDocuments
    8.8. Manipulating Stacked Perl Handlers
    8.9. Manipulating Stacked C Handlers
    8.10. Accessing the Environment
    8.11. Sharing Data Between Different Phases
    8.12. Determining the Current Request Phase
    8.13. Reading a Perl Module's Configuration Data
    8.14. Reading a C Module's Configuration Data

9. Tuning Apache and mod_perl

    9.1. Gathering Basic Server Information
    9.2. Gathering Systemwide Memory Usage Data
    9.3. Gathering Basic Server Memory Data
    9.4. Gathering Detailed Server Memory Data
    9.5. Gathering Memory Data for Perl Modules
    9.6. Reducing Module Overhead
    9.7. Reducing Overall Memory Consumption
    9.8. Increasing Shared Memory
    9.9. Coarse Process Tuning Using Apache Directives
    9.10. Limiting Process Growth
    9.11. Stopping Runaway Processes
    9.12. Profiling Handlers
    9.13. Finding Performance Bottlenecks
    9.14. Server Performance Tuning
    9.15. Using Apache as a Reverse Proxy Server
    9.16. Using the Perl Debugger with mod_perl
    9.17. Debugging Apache::Registry Scripts
    9.18. Reducing Debug Overhead
    9.19. Debugging Segmentation Faults

10. Object-Oriented mod_perl

    10.1. Class and Object Creation
    10.2. Method Inheritance
    10.3. Creating Method Handlers
    10.4. Using Method Handlers
    10.5. Subclassing the Apache Class
    10.6. Subclassing the Apache Class Using XS
    10.7 Subclassing Apache::Registry
    10.8. Subclassing Apache::Request

Part III Programming the Apache Lifecycle

11. The PerlInitHandler

    11.1. Processing Every Request
    11.2. Processing Every Request to a <Location>
    11.3. Timing the Request
    11.4. Interrupting the Request Cycle

12. The PerlTransHandler

    12.1. Redirecting Requests to favicon.ico
    12.2. Protecting Name-Based Virtual Hosts
    12.3. Storing Sessions in URLs
    12.4. Sharing a Common DocumentRoot
    12.5. Controlling Apache's Built-In Proxy
    12.6. Reducing stat() Calls

13. The PerlAccessHandler, PerlAuthenHandler, and PerlAuthzHandler

    13.1. Simple Access Control
    13.2. Restricting Access to Greedy Clients
    13.3. Basic Authentication
    13.4. Setting User Credentials
    13.5. Conditional Authentication
    13.6. User Authorization
    13.7. Writing Your Own Authentication Mechanism
    13.8. Using Digest Authentication

14. The PerlTypeHandler and PerlFixupHandler

    14.1. Resetting the Default Apache Handler
    14.2. Selecting PerlHandlers Based on File Extensions
    14.3. Customizing Request MIME Type and Content Handler
    14.4. Overriding Default MIME Types
    14.5. Using Apache as a Caching Engine

15. The PerlHandler

    15.1. A Basic PerlHandler
    15.2. Managing Multiple PerlHandlers
    15.3. Sending Mail
    15.4. Filtered Content Generation
    15.5. Preventing Cross-Site Scripting Attacks
    15.6 Using Text::Template
    15.7. Using HTML::Template
    15.8. Using Apache::ASP
    15.9. Using Template Toolkit
    15.10. Using HTML::Embperl
    15.11. Using HTML::Mason
    15.12. Generating XML Documents
    15.13. Generating Generic XML Content
    15.14. Using XML and XSLT Stylesheets
    15.15. Using AxKit
    15.16. Creating a SOAP Server

16. The PerlLogHandler and PerlCleanupHandler

    16.1. Logging to a Database
    16.2. Logging to a Flat File
    16.3. Altering the Request-Line
    16.4. Logging Nonstandard Data
    16.5. Conditional Logging
    16.6. Intercepting Errors

17. The PerlChildInitHandler, PerlChildExitHandler, PerlRestartHandler, and PerlDispatchHandler

    17.1. Passing Configurations to Code Outside of a Request
    17.2. Running Code When Apache Restarts
    17.3. Preloading Configuration Data
    17.4. Reloading Registry Scripts in the Parent Process
    17.5. Identifying Apache Children
    17.6. Preconnecting to Data Sources
    17.7. Tracking Perl Module Usage
    17.8. Overriding Handlers Using a PerlDispatchHandler

Appendix A - Available mod_perl Hooks and Build Flags

    mod_perl Hooks
    mod_perl Build Options

Appendix B - Available Constants

    Handler Return Codes
    HTTP Return Codes
    Directive Handler Constants
    Logging Constants
    Server Constants

Appendix C - mod_perl Resources

    Online Resources