Apache::Handlers is a Perl module that provides two different methods of declaring when code snippets should be run during the Apache request phase.
The code defined with the constructs provided by this module do not directly affect the success or failure of the request. Thus, this module does not provide a replacement for content, access, or other handlers.
The code is executed in the order it is encountered except for CHILDEXIT, CLEANUP, PerlChildExitHandler, and PerlCleanupHandler code. These are executed in the reverse order, similar to the pairing of BEGIN and END blocks.
The block construct or attribute must be run before the phase it refers to. Otherwise, it won't be run in that phase. The phases are run in the following order:
CHILDINIT TRANS HEADERPARSER ACCESS AUTHEN AUTHZ TYPE FIXUP CONTENT LOG CLEANUP CHILDEXIT
The RESTART phase is not an actual Apache request phase and has no effect after the server has started. It is used to define code that should run during the server startup phase when Apache reads the server configuration the second time or is gracefully (or not so gracefully) restarted. It should be used to clean up so the second configuration process won't duplicate information or cause errors.
If this module is called during the ChildInit phase, then it will only call that code associated with CHILDINIT blocks. Otherwise, the CHILDINIT code will be run at the first opportunity (basically, the first request made of the child process). Thus the two Perl*Handler configuration directives in the Synopsis.
use Apache::Handlers qw(CLEANUP);
my $session : PerlCleanupHandler;
our $global = undef;
< Perl >
Apache::Handlers -> reset;
< /Perl >