Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perl Critic: Comma used to separate statements

Follow code is not accepted by Critic, severity 4:

return {
    'debug'  => $debug,
    'identifier' => $identifier
};

I get this error:

# Perl::Critic found these violations in "filename.pl":
# Comma used to separate statements at line 356, column 3.  See pages 68,71 of PBP.  (Severity: 4)

But this code is accepted without any remark:

my $result = {
    'debug' => $debug,
    'identifier' => $identifier
};

return $result; 

Is it really better to write my return using a temporary variable, or is the critic wrong in detecting a Comma used to separate statements while I'm just constructing and returning a hashref?

like image 882
Konerak Avatar asked Feb 02 '12 10:02

Konerak


1 Answers

I found this bug in version 1.105, it is gone in version 1.116. It got fixed somewhere in between there.

The fix is not mentioned in the change logs, but PPI changes are mentioned. May have been a PPI error.

like image 194
Bill Ruppert Avatar answered Nov 01 '22 22:11

Bill Ruppert