mod_perl: "our" vs. "my" in CGI scripts
Benton, Kevin
kevin.benton at amd.com
Thu Jun 22 19:56:07 UTC 2006
> On Thu, 2006-06-22 at 14:43 +0200, Frédéric Buclin wrote:
> > Much better is to pass $var to foo() as argument: foo($var).
>
> Yes, agreed.
>
> > I think
> > only a few scripts use this kind of pseudo-global variables anyway. We
> > should fix them (e.g. process_bug.cgi and maybe token.cgi too).
>
> Unfortunately, many scripts assume $cgi and $template are globals.
> I'm
> working on that now. In some scripts I'm fixing the assumption. In
> others I'm making them globals, depending on whichever is easier for
> now.
>
> The only global we should normally have is $vars. Subroutines do
> have a
> real reason to modify that.
I wonder, does it make sense to get rid of $vars completely and replace it in a part of our interface (maybe a UI class)? I don't know, but it seems to me that using a UI class to handle all the interaction with the user would be a better way to go than to have global $cgi and $vars floating around... :)
---
Kevin Benton
Perl/Bugzilla Developer/Administrator, Perforce SCM Administrator
AMD - ECSD Software Validation and Tools
The opinions stated in this communication do not necessarily reflect the view of Advanced Micro Devices and have not been reviewed by management. This communication may contain sensitive and/or confidential and/or proprietary information. Distribution of such information is strictly prohibited without prior consent of Advanced Micro Devices. This communication is for the intended recipient(s) only. If you have received this communication in error, please notify the sender, then destroy any remaining copies of this communication.
More information about the developers
mailing list