On 5/9/05, J.e. Turcotte <[EMAIL PROTECTED]> wrote:
> Has anyone encountered similar problems? Does anyone have a deeper
> understanding of the whole apache/mp/perl setup to just ~know~ what these
> symptoms are indicitive of?
I'm sorry if this is completely unrelated, I am somewhat of a mp newbie.
I've been recently bitten by some very similar problems on some
scripts (not mp handlers) where CGI parameters and cookies were
not being read correctly -- sometimes my script was seeing GET
and POST parameters completely unrelated to what the browser sent.
My scripts all looked like:
use strict;
use CGI;
my $cgi = new CGI();
sub process {
my $x = $cgi->param('x');
# ...
}
process();
Because the problem only appears when an apache process
is executing a script for the second time, it is very hard to track
(reducing the number of apache children to 1 is very helpful
for debugging). This problem and many possible solutions
are described in great detail in
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#my___Scoped_Variable_in_Nested_Subroutines
To understand why it is related to scripting in mp, see
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#When_You_Cannot_Get_Rid_of_The_Inner_Subroutine
I changed "my $cgi = ..." to "local our $cgi = ..." and everything
started to work magically.
Ricardo