Perl: the Markov chain saw | |
PerlMonks |
Re: Why is the error thrown from close(FH) when the error is the missing <> on while(FH)? ( line number mismatch, look above, look before )(Bareword found in conditional)by Anonymous Monk |
on Feb 01, 2013 at 09:03 UTC ( [id://1016478]=note: print w/replies, xml ) | Need Help?? |
My question is: Why is the error not thrown from the while on 83? It is, it just doesn't say line 83, the line number is wrong, it is a mismatch, example
I vaguely remember when I first learned to always look at the earliest error message, start at the reported line number, and look before, look above -- this is especially true in perl :) But you've found a new bug in strict.pm, consider
With strict the following error message is misleading
If you look at line 4, you'll see close STDIN, but we know close takes barewords -- it can be very confusing even if you know to look above But with warnings the error message is more informative
Sure, the line number is wrong (and the program runs forever, infinite loop is infinite), but we know close STDIN; is not a conditional , so there is less confusion OTOH :) here is where the advantage falls apart , a conditional close STDIN if fileno STDIN; or fileno STDIN and close STDIN;
so warnings can detect a bareword in a conditional, strict can name the bareword, strict should say it is in a conditional, its more informative
On the history of the line number bug
:) Perl gets the line number right in the beginning (: (see "junk:" below)
update: :) I acknowledge kcott beat me to the punch , I mean he struck first, I mean I'm not a violent person at all, its just an expression, he posted first :p
In Section
Seekers of Perl Wisdom
|
|