[cgiapp] cgi::application::dispatch and modperl

Kurt Lidl kurt.lidl at cello.com
Fri Oct 8 11:12:39 EDT 2010


  I've got an application that is running in a mod_perl environment:

Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/1.0.0a DAV/2 
mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.12.1

I'm using CGI::Application::Dispatch to route incoming requests to the 
various
modules.

I have Apache configured like this:

<IfModule mod_perl.c>
     PerlModule Apache::DBI
<Location /foo>
         SetHandler perl-script
         PerlHandler Foo::Dispatch
         Order allow,deny
         Allow from all
</Location>
</IfModule>

Now this is all basically working, but not exactly as I would expect.
I see that for request that comes in, both cgiapp_init as
well as cgiapp_prerun get executed, for every request.

I expected that cgiapp_init would get executed only when
Apache spawns each child process.  And of course,
the cgiapp_prerun should be executed for each request.

I'm at a loss as to what to investigate next.  I tried moving
the SetHandler in the Apache configuration to be "modperl"
rather than "perl-script".  I had to turn add a PerlOptions +GlobalRequest
to make this run at all, but then my methods don't return any data
to the browser.

My basic question is why does cgiapp_init get called on every
request, rather than just once when apache spawns the
process that will handle (multiple) requests?

Thanks.

-Kurt




More information about the cgiapp mailing list