On Jun 8, 2006, at 3:11 AM, Tom Williams wrote:
and I noticed I'm not getting a new worker process after the form
is sent, which is possibly fine. I'm suspecting the Apache process
where the script ran is hanging out and contains the old form data
in its environment so that when I submit a new form, the new form
data is appended in the same environment the previously run form
ran in. Make sense?
Is any of this related to mod_perl or is this an Apache 2 worker
MPM issue?
its because you're running a poorly written cgi-script in mod_perl.
chances are it doesn't 'use strict' or warning, and it doesn't
instantiate any or all variables with a scope.
i can't seem to find it in the docs... it was well documented in 1.x,
maybe the text lost its way into 2.x?
in any event...
the apache processes isn't hanging out, its doing what it should:
since mp compiles and caches code to be a persistant environment and
doesn't 'exit', if a variable is left unscoped or poorly scoped, it's
not destroyed before the next run.
bad example, but:
script A:
if ( $a ) { $a+= 1 }
script B:
my $a;
if ( $a ) { $a+= 1 }
in script A, every time mp is run, $a is incremented. a is never set
to 0., so it just += from the last value (which was $a at the end of
the last request )
in script B, every time mp is run, $a is initialized (my $a )
in order to get your expected behavior, you'll have to 'use strict'
and go through the code you downloaded making sure everything is
scoped right, using my/our/local and blocks as necessary.
make sure you initialize/instantiate all of your variables or just
expect thigns to not work.
that said...
running mod_php and mod_perl together is a nightmare in terms of
memory management. my advice is don't do that. push the php out via
fastcgi , proxy it to lighty/fastcgi, or run apache on different
ports- one with mod_php loaded, and the other with mod_perl.
see:
http://perl.apache.org/docs/2.0/user/coding/coding.html#Cleaning_up
http://perl.apache.org/docs/general/perl_reference/
perl_reference.html#my____Scoped_Variable_in_Nested_Subroutines
//Jonathan Vanasco
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -