NAME
Apache::Registry - Run unaltered CGI scripts through mod_perl
SYNOPSIS
#in httpd.conf
PerlAlias /perl/ /perl/apache/scripts/ #optional
PerlModule Apache::Registry
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
...
</Directory>
DESCRIPTION
URIs in the form of: http://www.host.com/perl/file.pl
Will be compiled as the body of a perl subroutine and executed. Each server process or 'child' will compile the subroutine once and store it in memory until the file is updated on the disk.
The file looks much like a "normal" script, but it is compiled or 'evaled' into a subroutine.
Here's an example:
my $r = Apache->request;
$r->content_type("text/html");
$r->send_http_header;
$r->print("Hi There!");
SECURITY
Apache::Registry::handler will preform the same checks as mod_cgi before running the script.
ENVIRONMENT
The Apache functions `warn' and `exit' override the Perl core built-in functions.
DEBUGGING
You may set the debug level with the $Apache::Registry::Debug bitmask
1 => log recompile in errorlog
2 => Apache::Debug::dump in case of $@
4 => trace pedantically
CAVEATS
Apache::Registry makes things look just the CGI environment, however, you must understand that this *is not CGI*. Each httpd child will compile your script into memory and keep it there. Many times you've heard "always use -w
, always use -w
and 'use strict'". This is more important here than anywhere!
SEE ALSO
perl(1), Apache(3), Apache::Debug(3)
AUTHORS
Andreas Koenig <andreas.koenig@franz.ww.tu-berlin.de> and Doug MacEachern <dougm@osf.org>