Subject: | 1.03 for loop and sort blocks |
Date: | Wed, 21 Feb 2007 23:26:21 +0100 |
To: | bug-Perl-Critic [...] rt.cpan.org |
From: | Heiko <heiko [...] hexco.de> |
Hello,
thanks for your work!
FYI
This nonsense snippet perlcritic_bug1.pl
# $Id$
# $Version$
package perlcritic_bug1;
use strict;
use warnings;
our $VERSION = '1.0';
for my $entry (
sort {
my @a = split m{,}xms, $a;
my @b = split m{,}xms, $b;
$a[0] cmp $b[0] || $a[1] <=> $b[1]
} qw( b,6 c,3 )
)
{
print;
}
1;
gives the following messages with 'perlcritic -1 perlcritic_bug1.pl'
(Perl::Critic Version 1.03)
C-style "for" loop used at line 9, column 16. See page 97 of PBP.
(Severity: 2)
Forbid $b before $a in sort blocks at line 10, column 5. See page 152
of PBP. (Severity: 1)
Sort blocks should have a single statement at line 10, column 5. See
page 149 of PBP. (Severity: 3)
I think the last line from perlcritic is ok, but the first two lines
seem wrong
(with a seperate comparison routine these effects would not happen of
course).
This was found under Windows XP cygwin, perl v5.8.7. with Perl::Critic 1.03
Best Regards,
Heiko Eißfeldt