[cgiapp] cgiapp with Net::Server
Ron Savage
ron at savage.net.au
Sun Mar 9 23:15:35 EDT 2008
HI Mark
On Sun, 2008-03-09 at 17:50 -0700, Mark Fuller wrote:
> Browsing the source for CGI.pm I noticed it calls
> "initialize_globals()" when the class is loaded, but not when
> instances are created. But, it does call it for each instance if the
> mod_perl environment variable is set. (But, that does other things you
> wouldn't want to do if you're not really using mod_perl). I also
> noticed that it detects ActiveState's "PerlEx" (persistent Perl
> utility) and calls "_reset_globals" which calls "initialize_globals".
>
> I added a teardown method to Torsten's WebApp.pm and called
> "$self->query()->initialize_globals()". The problem disappeared. (I
> used teardown because that was the only place I could think to do it.
> I guess a cgiapp_get_query would be more appropriate. Do the "new" and
> then initialize_globals.).
Good bit of detective work. Well done.
> So, it's definitely an issue with CGI.pm. Apparently the params are
> globals (class data). And, it doesn't have a catch-all "persistence"
> flag. It has a flag for mod_perl. And, detects PerlEx. But, if you use
> something else (like Net::Server's prefork) you're screwed.
>
> CGI::Simple doesn't have this problem. The params aren't class data.
> And, it calls initialize_globals with each instance (without going
> through a bunch of questions about mod_perl or perlex). Reminds me why
> I like CGI::Simple.
Yep - don't we all...
--
Ron Savage
ron at savage.net.au
http://savage.net.au/index.html
More information about the cgiapp
mailing list