When a listening server receives an incoming request, it reads the HTTP request line and parses any HTTP headers sent along with it. Provided that what's been read is valid HTTP, Apache gives modules an early chance to step in during the post_read_request phase, known to the Perl API world as the PerlPostReadRequestHandler. This is the very first callback that Apache makes when serving an HTTP request, and it happens even before URI translation turns the requested URI into a physical pathname.
The post_read_request phase is a handy place to initialize per-request data that will be available to other handlers in the request chain. Because of its usefulness as an initialization routine, mod_perl provides the directive PerlInitHandler as a more readable alias to PerlPostReadRequestHandler.
Since the post_read_request phase happens before URI translation, PerlPostReadRequestHandler cannot appear in <Location>, <Directory>, or <Files> sections. However, the PerlInitHandler directive is actually a bit special. When it appears outside a <Directory> section, it acts as an alias for PerlPostReadRequestHandler as just described. However, when it appears within a <Directory> section, it acts as an alias for PerlHeaderParserHandler (discussed later in this chapter), allowing for per-directory initialization. In other words, wherever you put PerlInitHandler, it will act the way you expect.
Several optional Apache modules install handlers for the post_read_request ...