in reply to Re: Re: Best perl environment for mySQL server?
in thread Best perl environment for mySQL server?

In mod_perl, global variables keep their values over multiple requests, but that might not be a problem in configuration variables, because they usually do not change their values after initialisation.

I usually reference global 'constant' variables like:

# create global config package MyConfig; our $OPTION = 'option_value'; # and in some other file do: use MyConfig; print $MyConfig::OPTION;

I'm not 100% sure about this setup, though. On the one hand, accessing global variables with a package prefix makes for hard to spot spelling errors, on the other you can interpolate variables much more easily than constants created by use constant.

My 'reasonably paranoid' solution is to use warnings FATAL => 'all'; to intercept usage of undefined variables (and to force myself not to clog my error logs with useless warnings).

Local (not my) variables can be a problem in general and I would suggest not using them unless you really, really have to (like temporarily replacing a special global). I'm not aware of specific mod_perl problems with them, though. (But I might have missed something, as I said, I try to avoid using local variables at all).

HTH,
Joost