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

People
Owner: Nobody in particular
Requestors: phillipm [...] tierra.net
Cc:
AdminCc:

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



Subject: false positive for parens used with substr and unpack
Date: Mon, 25 Sep 2006 13:44:10 -0700
To: bug-Perl-Critic [...] rt.cpan.org
From: <phillipm [...] tierra.net>
Hi, using Perl::Critic-0.2 with perl 5.8.8 on FreeBSD, I get "Builtin function called with parens at ..." for the following statements: print substr($foo, 2, 3), "\n"; if ( unpack('V', $foo) == 2 ) { ... } I see from bug #14731 that this has been resolved for LIST-accepting builtins. The same fix would work for substr and unpack. Thanks. Phil
Show quoted text
> if ( unpack('V', $foo) == 2 ) { ... }
Technically, I think the parens are unecessary here because unpack takes exactly two arguments. However, I agree that the parens definitely improve readability, so we've changed the rules to allow parens whenever they are followed by a high-precendence operator. The fix is available in SVN revision 885, and will be in the next release of Perl-Critic, which should be a couple weeks away.
This has been fixed in Perl-Critic-0.22 -Jeff