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:
56622
Status:
rejected
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
JARIAALTO [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
Normal
Broken in:
(no value)
Fixed in:
(no value)



Subject: -1 is not one of the allowed literal values (0, 1, 2) (possibly false positive)
-1 is not one of the allowed literal values (0, 1, 2). Use the Readonly module or the "constant" pragma instead at line 6, 1 #!/usr/bin/perl 2 use strict; 3 4 my ($debug); 5 6 $debug = -1;
Subject: Re: [rt.cpan.org #56622] -1 is not one of the allowed literal values (0, 1, 2) (possibly false positive)
Date: Thu, 15 Apr 2010 07:58:07 -0500
To: bug-Perl-Critic@rt.cpan.org
From: Elliot Shank <perl@galumph.com>
On 4/15/10 5:43 AM, Jari Aalto via RT wrote:
Show quoted text
> -1 is not one of the allowed literal values (0, 1, 2). Use the Readonly > module or the "constant" pragma instead at line 6, > > 1 #!/usr/bin/perl > 2 use strict; > 3 > 4 my ($debug); > 5 > 6 $debug = -1;
How is -1 an element of the set (0, 1, 2)?
On Thu Apr 15 08:58:21 2010, clonezone wrote:
Show quoted text
> On 4/15/10 5:43 AM, Jari Aalto via RT wrote:
> > -1 is not one of the allowed literal values (0, 1, 2). Use the
Readonly
Show quoted text
> > 6 $debug = -1; > > How is -1 an element of the set (0, 1, 2)?
And why wouldn't a standard -1, 0, -1 be an allowed set. Why is there arbitrary "2" in it?
Subject: Re: [rt.cpan.org #56622] -1 is not one of the allowed literal values (0, 1, 2) (possibly false positive)
Date: Wed, 21 Apr 2010 20:22:53 -0500
To: bug-Perl-Critic@rt.cpan.org
From: Elliot Shank <perl@galumph.com>
On 4/15/10 8:47 AM, Jari Aalto via RT wrote:
Show quoted text
> Queue: Perl-Critic > Ticket<URL: https://rt.cpan.org/Ticket/Display.html?id=56622> > > On Thu Apr 15 08:58:21 2010, clonezone wrote:
>> On 4/15/10 5:43 AM, Jari Aalto via RT wrote:
>>> -1 is not one of the allowed literal values (0, 1, 2). Use the
> Readonly
>> >> 6 $debug = -1; >> >> How is -1 an element of the set (0, 1, 2)?
> > And why wouldn't a standard -1, 0, -1 be an allowed set. Why is there > arbitrary "2" in it?
From the documentation: "By default, this rule is relaxed in that C<2> is permitted to allow for common things like alternation, the STDERR file handle, etc.." There is a special exemption for -1 as a subscript, i.e. $x[-1] is not a violation. If you disagree with the default set of allowed values, specify the ones you prefer: [ValuesAndExpressions::ProhibitMagicNumbers] allowed_values = -1 0 1


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.