Jeff Pang wrote:
I think the only difference between the two is Stat's code do the things of sharing vars across modules really. Under mod_perl,the situation is very different from common CGI environment,and the vars sharing sometimes is useful and needed. I hope I'm correct.If not,the criticism are welcome.
The OP was asking about understanding the code, not what are the best practices. First of all, I would never call an object by a single letter. Something like $CGI_Obj would be better. And being a global, it starts with a capital.
Yes, I would be more inclined to pass the object to the subroutines than use it as a global. I would use Exporter only to export subroutines, not variables because, as discussed, it is difficult to understand what is happening.
I don't use mod_perl but my understanding it that it doesn't, or didn't, reset the globals to the default state (which is undef). Of course, setting all your variables to a known state before using them is consider good practice; so you should never encounter this problem ;)
-- Just my 0.00000002 million dollars worth, --- Shawn "Probability is now one. Any problems that are left are your own." SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_ * Perl tutorials at http://perlmonks.org/?node=Tutorials * A searchable perldoc is available at http://perldoc.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>