What most people want to do with
installation assumes this request by enabling the
callback hook by default, and by installing the Apache::Registry module.
is the handler used for the content retrieval stage of the
Apache::Registry is the
Perl module that emulates the CGI environment so you can use
"standard" Perl CGI scripts with
having to rewrite them (much). This is by far the cheapest way to get
improved CGI performance.
each individual CGI program is compiled and
cached the first time it is called (or whenever it
is changed), and then remains available
for all subsequent instances of that CGI script.
This process avoids the costs of startup time.
Whereas most CGI scripts are kept in
scripts that use Apache::Registry are placed in a
separate directory, e.g.,
Apache configuration file needs to point
to this directory by setting an alias and defining
a handler for this new location.
Alias /perl-bin/ /usr/local/apache/perl-bin/
Instead of using the
handler, we use
handler to give control to
that the Apache::Registry module should
be used for serving all files in that directory.
directive; in this case, it tells
to send response
lines and common headers - by default, none are sent. (For NPH scripts,
you'll want to turn this feature off again.)
is a standard Apache header
needed to tell Apache to treat the script as a CGI script.
If you want to load Perl modules in addition to Apache::Registry,
you can use the PerlModule directive:
If you include this line, you shouldn't need to explicitly
in each Perl CGI script anymore, as CGI.pm
will be loaded directly from the Apache server. Up to ten
modules can be listed with the
CGI scripts in the new directory should work now. However,
if you have problems, the
manpage offers some
words of wisdom:
"Standard" CGI scripts start with a clean slate every time.
When switching to
, CGI programmers are often
surprised to learn how often
they take advantage of this fact.
tells you when your variables haven't been properly declared
and might inherit values from previous invocations of the script.
at the end of every program is a habit
of many programmers. While often totally unnecessary, it
usually doesn't hurt...except with
If you're using
kills the server
last function call, you can just remove it.
If the structure of your program is such that it is called
from the middle of the script, you can just put a label
at the end of the script and use
call you can use if you're
really attached to
If you're using Apache::Registry, you don't
have to worry about this problem. Apache::Registry is
smart enough to override all
In addition, it is recommended that you should use a recent
version of Perl and of CGI.pm. You should scan the
documentation for the very latest compatibility news.