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: 33935
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: Heiko <heiko [...] hexco.de>
Subject: ProhibitCommaSeparatedValues doesn't handle hash dereferences.
Date: Sun, 09 Mar 2008 16:47:59 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
ValuesAndExpressions::ProhibitCommaSeparatedValues gives: Comma used to separate statements at line 10, column 18. See pages 68,71 of PBP. (Severity: 4) on this code: my $href = { '1' => undef, '2' => undef }; func( @{ $href }{'1', '2'} ); sub func { } The solution in the patch is to detect the block context.
--- ProhibitCommaSeparatedStatements.pm.org 2008-02-25 23:06:18.718750000 +0100 +++ ProhibitCommaSeparatedStatements.pm.new 2008-02-23 23:20:20.265625000 +0100 @@ -42,7 +42,7 @@ # Now, if PPI hasn't introduced any new PPI::Statement subclasses, we've # got an element who's class really is PPI::Statement. - return if _is_parent_a_constructor_or_list($elem); + return if _is_parent_a_constructor_or_list_or_block($elem); return if _is_parent_a_foreach_loop($elem); foreach my $child ( $elem->schildren() ) { @@ -58,7 +58,7 @@ return; } -sub _is_parent_a_constructor_or_list { +sub _is_parent_a_constructor_or_list_or_block { my $elem = shift; my $parent = $elem->parent(); @@ -68,6 +68,7 @@ return ( $parent->isa('PPI::Structure::Constructor') or $parent->isa('PPI::Structure::List') + or $parent->isa('PPI::Structure::Block') ); }
I've added a TODO test for this case. I tried the attached solution, but it causes other test failures. I haven't investigated any further.
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. RT 49679 appears to be a report of the same thing, and will receive this same update.