Mike McLagan wrote:
> When B is invoked, within the same child, Apache::Registry DOES NOT reload
> CGI.pm and therefore does not initialize any of the variables, etc.  This
> results in the new() call in B REUSING (!) the @QUERY_PARAM which was built up
> during the new() call in A!  OOOPS!
> 
> In order to make it work, I had to dig thru CGI.pm and found a function that's
> in there with comments about mod_perl around it, specifically:
> 
>    CGI::initialize_globals();
> 
> If I add this call in before both of the new() invocations, I get the desired,
> expected results.

CGI.pm does not need the BEGIN block to be called each time.  It calls
the initialize_globals() function from a cleanup handler when running
under mod_perl.  It doesn't expect you to actually modify the request
before the cleanup handler runs (since the cleanup handler runs at the
end of every request).

You can call the function it yourself, which might mess up the original
settings because of the use globals, or you can use a CGI library that
doesn't rely on globals in this way.  CGI::Lite looks safe based on it's
OO interface, and Apache::Request is known to be safe, and there's
always $r->args.

- Perrin

Reply via email to