mod_perl logo perl icon
previous page: Apache::Registry - Run unaltered CGI scrips under mod_perlpage up: mod_perl 1.0 APInext page: Apache::RegistryLoader - Compile Apache::Registry scripts at server startup

Apache::PerlRun - Run unaltered CGI scripts under mod_perl






Practical mod_perl

Practical mod_perl

By Stas Bekman, Eric Cholet
The mod_perl Developer's Cookbook

The mod_perl Developer's Cookbook

By Geoffrey Young, Paul Lindner, Randy Kobes
mod_perl Pocket Reference

mod_perl Pocket Reference

By Andrew Ford
Writing Apache Modules with Perl and C

Writing Apache Modules with Perl and C

By Lincoln Stein, Doug MacEachern
Embedding Perl in HTML with Mason

Embedding Perl in HTML with Mason

By Dave Rolsky, Ken Williams
mod_perl2 User's Guide

mod_perl2 User's Guide

By Stas Bekman, Jim Brandt


Table of Contents

Synopsis

  #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>


TOP

Description

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.



TOP

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>


TOP

See Also

perl, mod_perl, Apache::Registry



TOP

Maintainers

Maintainer is the person(s) you should contact with updates, corrections and patches.



TOP

Authors

Only the major authors are listed above. For contributors see the Changes file.






TOP
previous page: Apache::Registry - Run unaltered CGI scrips under mod_perlpage up: mod_perl 1.0 APInext page: Apache::RegistryLoader - Compile Apache::Registry scripts at server startup