Whoever wrote CGI.pm surely knew how my variables work
because he used them, but he didn't think it was
practical to make the user defined variables local.
I never said anything otherwise. In fact, I follow this
same style myself: at the top of my programs, there are
typically some global variables (my, but
still treated as globally available) that control
behavior of the rest of the program. I think this is
healthy, and (among other things) promotes an eventual
migration to using options or other more advanced ways
of setting user preferences.
Everyone seems to be picking on the cosmetic things
or the things they wouldn't need. Remember, along
with the values, you get the variable names, which
someone decided is useful since they're provided by
Xref.
I addressed this obliquely before, but: there is an
implicit assumption here on perlmonks that any code
posted is open for criticism. In this case, we first
criticized its higher-level "in the large"
function: supporting a coding
style that we find painful and distasteful. When you
said that you were stuck with (or were going to stand
by) that coding style, I took it upon myself to address
some of the "in the small" deficiencies. Now you
complain that we're nitpicking.
Which leaves us in the same position as has shown up
a few times already: if you didn't want criticism, then
explicitly say so. If you do post something that way,
though, don't expect us to endorse it for enclusion into
CPAN or even as a node that should survive here on
perlmonks.
It's impossible for anyone to say that a script is a
maintenance nightmare just because it uses all globals,
no warnings and no strict.
No, but it is entirely possible to say that in one's
experience, scripts that use strict,
use warnings (or the older -w),
and minimal globals are easier to maintain, modify,
and debug. So, when confronted with a script written
in a style which avoids all these programming aids (make
no mistake, that is how the majority of monks perceive
them), we are justified in guessing that this script will
be more of a pain in the ass than most.
Forgot to mention another benefit of VarStructor. It
could help you be sure that your variables are "my"
variables.
Funny, but that's one of the things that
use strict does for me.
| [reply] [d/l] [select] |