mod_perl: "our" vs. "my" in CGI scripts
Dennis Melentyev
dennis.melentyev at infopulse.com.ua
Thu Jun 22 15:30:55 UTC 2006
В чт, 22/06/2006 в 05:56 -0700, Max Kanat-Alexander пишет:
> 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 also like this more than [local] our.
> > 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.
What about passing it to subroutine by reference? Or, use helpers like
Bugzilla::cgi(), Bugzilla::template() or Bugzilla::vars() to get the
instances (anyway by ref)?
More information about the developers
mailing list