NAME

Apache2::Controller::PerChildInit - PerChildInit handler for child process setup in A2C.

VERSION

Version 1.000.111

SYNOPSIS

<VirtualHost 127.238.349.450:80>
    
    PerlLoadModule      Apache2::Controller::PerChildInit
    PerChildInitHandler Apache2::Controller::PerChildInit

    <Location /a2c_somewhere>
        # normal Apache2::Controller::Dispatch setup
    </Location>

</VirtualHost>

DESCRIPTION

This is a SERVER init handler that runs once when an Apache2 child process is spawned.

INITIALIZATION ITEMS

These are the items initialized once per Apache2 child when the PerChildInitHandler runs.

LOGGING

Replaces the Log::Log4perl appender for loggers in the Apache2::Controller namespace with one that sends the errors to the Apache2 error log facility with the appropriate log level.

This factors out the common parts of handlers in the Apache2::Controller framework other than the main response handler. These non-response handlers like Dispatch and Session do not need to create the Apache2::Request object (I think...), so that is put off until the Response phase.

You should not use this module for anything that you're doing.

Pre-response phase handlers do not handle errors in the same way that Apache2::Controller does. If you get an error in a pre-response phase, A2C cannot call your render class error() method, because that stuff is not set up yet. Instead, it spits the error to the error log, logs the reason for the response code, and returns the response code. This should get Apache to quit processing the chain of handlers... we'll see.

METHODS

handler

handler() takes the request, creates an object using the child class name, runs the process() method, and handles errors.

new

new() creates an object of the child class and assigns the Apache2::RequestRec object to $self->{r}.

If the parent class defines a method init(), this will be called at the end of object creation.

Unlike Apache2::Controller, the handler object of other handlers that use this package as a base do not create, delegate to and subclass the Apache2::Request object. They just keep the original Apache2::RequestRec object in $self->{r}.

SEE ALSO

Apache2::Controller::NonResponseRequest

Apache2::Controller::Dispatch

Apache2::Controller::Session

Apache2::Controller

AUTHOR

Mark Hedges, <hedges at formdata.biz>

COPYRIGHT & LICENSE

Copyright 2008-2010 Mark Hedges, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

This software is provided as-is, with no warranty and no guarantee of fitness for any particular purpose.