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

People
Owner: Nobody in particular
Requestors: perl [...] galumph.com
Cc:
AdminCc:

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



CC: marcos rebelo <oleber [...] gmail.com>
Subject: false positive in ValuesAndExpressions::ProhibitCommaSeparatedStatements
Date: Sun, 13 Sep 2009 21:06:45 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
seems to me that I have a false positive in the rule: Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements my ( $var1, $var2 ) = @{$message}{ 'var_1', 'var_2' }; seems to don't understand the hash ref slice. Best Regards Marcos Rebelo -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org
Subject: Re: [rt.cpan.org #49679] false positive in ValuesAndExpressions::ProhibitCommaSeparatedStatements
Date: Sun, 13 Sep 2009 21:34:49 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Elliot Shank via RT wrote: Show quoted text
> seems to me that I have a false positive in the rule: > Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements > > my ( $var1, $var2 ) = @{$message}{ 'var_1', 'var_2' }; > > seems to don't understand the hash ref slice.
Actually, it's PPI that doesn't understand the slice. PPI::Document PPI::Statement::Variable [ 1, 1, 1 ] PPI::Token::Word 'my' PPI::Structure::List ( ... ) PPI::Statement::Expression [ 1, 6, 6 ] PPI::Token::Symbol '$var1' [ 1, 11, 11 ] PPI::Token::Operator ',' [ 1, 13, 13 ] PPI::Token::Symbol '$var2' [ 1, 21, 21 ] PPI::Token::Operator '=' [ 1, 23, 23 ] PPI::Token::Cast '@' PPI::Structure::Block { ... } PPI::Statement [ 1, 25, 25 ] PPI::Token::Symbol '$message' PPI::Structure::Block { ... } PPI::Statement [ 1, 36, 36 ] PPI::Token::Word 'var_1' [ 1, 41, 41 ] PPI::Token::Operator ',' [ 1, 43, 43 ] PPI::Token::Word 'var_2' [ 1, 50, 50 ] PPI::Token::Structure ';'
I have taken the liberty of filing in the PPI queue RT 49826: PPI does not recognize @{$hash}{'foo', 'bar'} as slice on hash reference. A proposed patch to make the second set of curlys come out as a subscript was committed to Adam's SVN repository as revision 9109.
This appears to me to be fixed by PPI revision 1.208. The current production release of Perl::Critic (1.105) does not require this, but 1.105_01 does, and I suspect that users of Perl::Critic 1.105 will see the problem go away if they upgrade to PPI 1.208. At any rate, I have removed the TODO annotation from the relevant t/ValuesAndExpressions/ProhibitCommaSeparatedStatements.run in SVN revision 3768. This appears to be a report of the same problem as RT 33935, and is receiving the same update.