http://www.perlmonks.org?node_id=562939


in reply to mod_perl / Apache::Registry accidental closures

When I was bitten by this, I wanted static variables for some functions. I had something like this (very simplified example):
BEGIN { my $var; sub foo { return ++$var; } }
The solution was to move all such subroutines into modules where they wouldn't get wrapped by Apache::Registry.