mod_perl modifies the environment to make it appear as if the script
were being called under the CGI protocol. For example, the
$ENV{QUERY_STRING} environment variable is
initialized with the contents of $r->args( ),
and the value returned by $r->server_hostname(
) is put into $ENV{SERVER_NAME}.
But populating %ENV is expensive. Those who have
moved to the mod_perl API no longer need this duplicated data and can
improve performance by turning it off. Scripts using the
CGI.pm module require PerlSetupEnv
On because that module relies on the environment created by
mod_cgi. This is yet another reason why we recommend using the
Apache::Request module in preference to
CGI.pm.
Note that you can still set environment variables when
PerlSetupEnv is Off. For
example, say you use the following configuration:
PerlSetupEnv Off
PerlModule Apache::RegistryNG
<Location /perl>
PerlSetEnv TEST hi
SetHandler perl-script
PerlHandler Apache::RegistryNG
Options +ExecCGI
</Location>