Subject: | bug in Perl-Critic |
Date: | Tue, 14 Dec 2010 10:53:30 -0500 |
To: | bug-Perl-Critic [...] rt.cpan.org |
From: | John Deighan <jdeighan [...] pcgus.com> |
The following code (I've added line numbers):
1 # ----------------------------------------------------------
2
3 use strict;
4 use warnings;
5
6 sub func { my($align) = @_;
7
8 my $hAttr = ($align eq 'center') ? { 'class' => 'treeroot',
9 'display' => 'table',
10 'left-margin' => 'auto',
11 'right-margin' => 'auto',
12 }
13 : ($align eq 'right') ? { 'class' => 'treeroot',
14 'display' => 'table',
15 'left-margin' => 0,
16 'right-margin' => 'auto',
17 }
18 : { 'class' => 'treeroot'};
19
20 return $hAttr;
21 } # func()
22
23 # ----------------------------------------------------------
Results in the error:
---------------- C:\Scripts\test8.pl ----------------
Comma used to separate statements at line 8, column 38. See pages 68,71 of PBP.
Comma used to separate statements at line 13, column 38. See pages 68,71 of PBP.
--------------------------------------------------------------------------------
But, clearly, the commas are being used to separate keys and values in the definition of a hash.
Here is some info about my setup:
Perl-Critic: version 1.109 (I understand there's a 1.110, but it's not available via ppm)
Perl: version 5.10.0 from ActiveState
OS: Windows 2003 Server