Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 25071
Status: resolved
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: heiko [...] hexco.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.108



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
Hi! Thanks for reporting this. The Policy is confused because it sees two semi-colons in your "for" iterator, which is how it detects a C-style loop. I'm not exactly sure what's going on with the $a/$b stuff. Those are definitely bugs. But I think that particular construct is probably pretty rare, so it might be a while before I get to fixing it. Thanks again for letting us know. -Jeff
I can not duplicate this with the given perlcritic_bug1.pl file. What appears to have happened is that PPI got better and we benefited. What I can say for sure is that using PPI 1.213 the parse of the given file no longer contains a PPI::Structure::For object, which is what the policy looks for. The Perl::Critic version I tested with was 1.108. Does that make this a candidate for closure?
Subject: Re: [rt.cpan.org #25071] 1.03 for loop and sort blocks
Date: Thu, 22 Jul 2010 09:33:14 -0700
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
On 7/21/10 10:21 PM, Tom Wyant via RT wrote: Show quoted text
> Does that make this a candidate for closure?
Yes.