As you know, Perl has several magic global variables, subroutines, and literals that have the same meaning no matter what package they are called from. A handful of these variables have special meaning when running under mod_perl. Here we will describe these and other global variables maintained by mod_perl. Don't forget that Perl code has a much longer lifetime and lives among many more namespaces in the mod_perl environment than it does in a conventional CGI environment. When modifying a Perl global variable, we recommend that you always localize the variable so modifications do not trip up other Perl code running in the server.
We begin with the list of magic global variables that have special significance to mod_perl.
When running under Apache::Registry or Apache::PerlRun, this variable is set to that of the filename field of the request_rec.
When running inside of a <Perl> section, the value of $0 is the path to the configuration file in which the Perl section is located, such as httpd.conf or srm.conf.
Normally, this variable holds the path to the Perl program that was executed from the shell. Under mod_perl, there is no Perl program, just the Perl library linked with Apache. Thus, this variable is set to that of the Apache binary in which Perl is currently running, such as /usr/local/apache/bin/httpd or C:\Apache\apache.exe.
As the perlvar(1) manpage explains, if this variable ...