Apache::PerlRun(3pm)

Apache::PerlRun3pm

Run unaltered cgi scripts under mod_perl

Usage

 #in httpd.conf
 Alias /cgi-perl/ /perl/apache/scripts/ 
 PerlModule Apache::PerlRun
 <Location /cgi-perl>
 SetHandler perl-script
 PerlHandler Apache::PerlRun
 Options +ExecCGI 
 #optional
 PerlSendHeader On
 ...
 </Location>

Overview

This module's handler emulates the CGI environment, allowing programmers to write scripts that run under CGI or mod_perl without change. Unlike Apache::Registry, the Apache::PerlRun handler does not cache the script inside of a subroutine. Scripts will be "compiled" every request. After the script has run, it's namespace is flushed of all variables and subroutines.

The Apache::Registry handler is much faster than Apache::PerlRun. However, Apache::PerlRun is much faster than CGI as the fork is still avoided and scripts can use modules which have been pre-loaded at server startup time. This module is meant for "Dirty" CGI Perl scripts which relied on the single request lifetime of CGI and cannot run under Apache::Registry without cleanup.

Caveats

If your scripts still have problems running under the Apache::PerlRun handler, the PerlRunOnce option can be used so that the process running the script will be shutdown. Add this to your httpd.conf:

 <Location ...>
 PerlSetVar PerlRunOnce On
 ...
 </Location>

Releases

5 releases since Debian 2.1 (Slink); the text changed 4 times.

  1. 2.1
  2. 2.2
  3. 3.0
  4. 3.1
  5. 4.0

Author

Doug MacEachern

From libapache-mod-perl 1.29.0.4-4.1+etch1 in Debian 4.0 (Etch). Parsed by carta from the page's man source.