Your CGI script is called often, and the web server is suffering as a result. You'd like to lessen the load your CGI script causes.
Alias /perl/ /real/path/to/perl/scripts/ <Location /perl> SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI </Location> PerlModule Apache::Registry PerlModule CGI PerlSendHeader On
The snippet above says that requests with URLs starting in
are actually in
and that they should be handled by Apache::Registry. This runs them in a CGI environment.
works analogously to
. To make the suffix
<Files *.perl> SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI </Files>
Because the Perl interpreter that runs your CGI script doesn't shut down when your script is done (as normally happens when the web server runs your script as a separate program), you cannot rely on your global variables being undefined when the program starts.
Don't worry about how big your web server processes appear to grow from pre-loading all these scripts. They need to find their way into memory eventually, and it's better to happen before Apache forks off kids. That way each script has to be in memory only once, because forked children have shared memory pages (under all modern operating systems). In other words, it only appears to take up more memory this way. It actually takes less!