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: 43651
Status: open
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: marks [...] iskoot.co.il
Cc:
AdminCc:

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



Subject: False Positive in Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap
Date: Thu, 26 Feb 2009 11:15:57 +0200
To: <bug-Perl-Critic [...] rt.cpan.org>
From: Mark Stern <marks [...] iskoot.co.il>
Download (untitled) / with headers
text/plain 196b
The following code snippet produces a false positive: #!/usr/bin/perl use strict; use warnings; my @list = keys %{{map { $_ => 1 } qw(a b a c)}}; print "@list\n"; I am using version 1.093_01
Subject: Re: [rt.cpan.org #43651] False Positive in Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap
Date: Thu, 26 Feb 2009 07:17:59 -0600
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Download (untitled) / with headers
text/plain 1.2k
Mark Stern via RT wrote: Show quoted text
> The following code snippet produces a false positive:
[chop] Show quoted text
> my @list = keys %{{map { $_ => 1 } qw(a b a c)}};
This is a PPI parsing bug. The second curly gets parsed as a block and not a hash constructor. PPI::Document PPI::Statement::Variable [ 1, 1, 1 ] PPI::Token::Word 'my' [ 1, 4, 4 ] PPI::Token::Symbol '@list' [ 1, 10, 10 ] PPI::Token::Operator '=' [ 1, 12, 12 ] PPI::Token::Word 'keys' [ 1, 17, 17 ] PPI::Token::Cast '%' PPI::Structure::Block { ... } PPI::Statement::Compound PPI::Structure::Block { ... } PPI::Statement [ 1, 20, 20 ] PPI::Token::Word 'map' PPI::Structure::Block { ... } PPI::Statement [ 1, 26, 26 ] PPI::Token::Magic '$_' [ 1, 29, 29 ] PPI::Token::Operator '=>' [ 1, 32, 32 ] PPI::Token::Number '1' [ 1, 36, 36 ] PPI::Token::QuoteLike::Words 'qw(a b a c)' [ 1, 49, 49 ] PPI::Token::Structure ';'
Subject: Re: [rt.cpan.org #43651] False Positive in Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap
Date: Fri, 27 Feb 2009 00:13:30 -0600
To: bug-Perl-Critic [...] rt.cpan.org
From: Chris Dolan <chris [...] chrisdolan.net>
Download (untitled) / with headers
text/plain 510b
On Feb 26, 2009, at 3:18 AM, Mark Stern via RT wrote: Show quoted text
> The following code snippet produces a false positive: > > #!/usr/bin/perl > > use strict; > use warnings; > > my @list = keys %{{map { $_ => 1 } qw(a b a c)}}; > print "@list\n";
Instead of treating the symptom, why not treat the injury? my @list = keys %{{map { $_ => 1 } qw(a b a c)}}; print "@list\n" c a b use List::MoreUtils qw(uniq); my @list = uniq qw(a b a c); print "@list\n"; a b c But, yes, it is a PPI parsing bug as Elliot said. Chris


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.