I recently had to port a very old perl project to a new server, which is running mod_perl- that made me some headache as I didn’t know anything about that environment.
Pages with dynamic form input from CGI::param
suddenly seemed to be “cached”, the script did process old variables and emitted wrong output. After diggin’ into mod_perl with this great article the solution was quite easy.
mod_perl somehow keeps a persistent process environment, thus restoring variables declared with my
. As I didn’t want to rewrite the whole thing I simply changed lines like
my $type = param("type");
to
local $type = param("type");
and everything works fine and “uncached”. I know there are several pitfalls with local
again, anyway, I’m not into mod_perl, things seem to work and a 10-years old medieval project’s running again.