BigLug has asked for the wisdom of the Perl Monks concerning the following question:
My module is loading and executing as I'd expect, however it's reloading upon each call from the browser. AFAIK, mod_perl is supposed to load the module once when Apache starts up, and then it should call the handler() once for each request from a browser.
This was the impression that I got from what I've been able to read. However I could be wrong. Am I?
If I'm right, please take a look at my code and let me know where I went wrong. Let me know why it reloads my script every time I call the directory in which it sits.
My script is as follows. The warn() line is there so I can see from the logs (tail -f) when the script it reloaded:SetHandler perl-script PerlResponseHandler Some::Module
package Some::Module; use strict; use warnings; use CGI; use Apache::RequestRec (); use Apache::RequestIO (); use Apache::Const -compile => qw(OK); # Log the loading of this handler warn("Reloading the handler.\n"); # Code snipped to create a DBI object # Code snipped to create a Cache::File object # Code snipped to create a HTML::Template object #--------------------------------------------------------------------- +- # Master apache query handler #--------------------------------------------------------------------- +- sub handler { my $r = shift; my $c = new CGI; $r->content_type('text/plain'); print $c->param('output'); return Apache::OK; }
|
|---|