Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- perl-critic test failure; magic variable '5'
December 21, 2008, 5:58 pm
rate this thread
afternoon. I tracked the problem to t\Variables\Require
\LocalizedPunctionationVars.run, which, amid the list of magic
variables we know and love, listed '5', eg.
$PERL_VERSION = ();
$WARNING = ();
$EXECUTABLE_NAME = ();
$ARGV = ();
5 = ();
Now, I thought I knew perl pretty well, but I didn't know that '5' was
a magic variable! On my perl (5.10.0 34065), all the line generates is
"Can't modify constant item ..." and yet the tests are written as
though they expect this line to generate a policy warning 'localize
special variables' or somesuch. Changing the number of expected fails
in three locations in the LocalizedPunctionationVars.run resolved the
problem, and perl-critic installed ok.
Can anyone explain to me what's going on here? Is '5' really a
special variable? Why would the perl critic testers expect 5 = () to
generate a policy warning instead of a compile error? Is this only an
issue on cygwin?
Thanks for any info
Re: perl-critic test failure; magic variable '5'
I looked through that file on CPAN and those five lines were nowhere to
be found in it.
5 is not a variable at all!
$scalar = undef;
makes sense, and:
@array = ();
makes sense, but:
$scalar = ();
makes little sense at all.
Those people who think they know everything are a great
annoyance to those of us who do. -- Isaac Asimov