Personal:CGI Application with Mod Perl
Contents |
CGI Application and Mod Perl
For Apache 1.3.X
There are several ways that you can get mod_perl to execute your CGI::Application modules:
The easiest would be using the Apache::Registry module to run your current instance script, which should require no changes at all.
just add the following to your httpd.conf:
Alias /perl/ /usr/local/apache/perl/
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader On
Options +ExecCGI
</Location>
(verbatim from pg 42 of Writing Apache Modules with Perl and C by Lincoln Stein & Doug MacEachern, a must have for anyone serious about mod_perl)
For Apache 2.X
The easiest would be using the ModPerl::Registry module to run your current instance script, which should require no changes at all.
just add the following to your httpd.conf:
# httpd.conf
PerlModule ModPerl::Registry
Alias /perl/ /home/httpd/perl/
<Location /perl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
#PerlOptions +ParseHeaders
#PerlOptions -GlobalRequest
Options +ExecCGI
</Location>
Caveats
ModPerl::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, whereas CGI will run it once, cleaning out the entire process space. Many times you have heard "always use -w, always use -w and 'use strict'". This is more important here than anywhere else!