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

Owner: Nobody in particular
Requestors: EDAVIS [...]

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

Subject: ValuesAndExpressions::ProhibitCommaSeparatedStatements false positive
Download (untitled) / with headers
text/plain 529b
I see that #27654 is fixed, but this is another false positive for the same policy: #!/usr/bin/perl use warnings; use strict; use 5.010; sub foo {} foo { 0 => 1, 1 => 2 }; % perlcritic --verbose "%f:%l:%c:%m [%p] (%e)\n" -3 test test:6:7:Comma used to separate statements [ValuesAndExpressions::ProhibitCommaSeparatedStatements] (See pages 68,71 of PBP) This is a fairly minimal test case and has an unusual-looking anonymous hash which not everybody would write in real code, but there are other more normal-looking examples.
Subject: Re: [ #37885] ValuesAndExpressions::ProhibitCommaSeparatedStatements false positive
Date: Wed, 23 Jul 2008 09:42:59 -0700
To: bug-Perl-Critic [...]
From: Elliot Shank <perl [...]>
Download (untitled) / with headers
text/plain 815b
This specific example cannot be solved by static analysis. Dumping the tree for "foo { 0 => 1, 1 => 2 };" produces: PPI::Document PPI::Statement PPI::Token::Word 'foo' PPI::Structure::Block { ... } PPI::Statement PPI::Token::Number '0' PPI::Token::Operator '=>' PPI::Token::Number '1' PPI::Token::Operator ',' PPI::Token::Number '1' PPI::Token::Operator '=>' PPI::Token::Number '2' PPI::Token::Structure ';' I initially thought this was a bug, but you really can't tell without compiling whether "foo" is a label or a subroutine, yes, even with the sub declaration just above. And I'd agree with Alias and go for the former case when deciding. On this sort of thing, I'd suggest you post to the parse-perl list.

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

Please report any issues with to