The key is understanding how mod_perl -- specifically, Apache::Registry -- handles a script. Basically, what it does is take each script and turn it into a subroutine. That one subroutine is compiled and can be executed again and again, without recompiling, which is one reason scripts run faster under Apache::Registry. But it makes certain scoping issues come into play, so you are exhorted more loudly than ever to use strict and declare variables with my, to ensure you don't have values lingering from previous invocations of your script, which is now a subroutine.
I can't tell you exactly why you're seeing differences (especially since you post no code! hint, hint =), but a lot might depend on how you're making calls to your subroutines. Make sure you always call them with
sub_name(ARG LIST)
and you shouldn't see any weirdnesses. If you make those changes and are still having problems, come back and ask again, with more specifics about the problem and a minimal code that produces the problem.
HTH.
Creates a sub bar that can be called from anywhere.
Philosophy can be made out of anything. Or less -- Jerry A. Fodor
In reply to Re: mod_perl and function declrations
by arturo
in thread mod_perl and function declrations
by one4k4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |