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

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

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



Subject: Quotes used with an empty string (possible false positive)
Quotes used with an empty string at line 8, column 6. See page 53 of PBP. 1 #!/usr/bin/perl 2 use strict; 3 4 my $year = "2010"; # Set initial value 5 6 # Later in the code 7 8 $year = "" unless defined $OPT_NO_YEAR; Resetting $year to empty is valid.
Subject: Re: [rt.cpan.org #56634] Quotes used with an empty string (possible false positive)
Date: Thu, 15 Apr 2010 08:15:11 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
On 4/15/10 6:59 AM, Jari Aalto via RT wrote: Show quoted text
> Quotes used with an empty string at line 8, column 6. See page 53 of > PBP. > > 1 #!/usr/bin/perl > 2 use strict; > 3 > 4 my $year = "2010"; # Set initial value > 5 > 6 # Later in the code > 7 > 8 $year = "" unless defined $OPT_NO_YEAR; > > Resetting $year to empty is valid.
But the way you should be doing this, according to Conway, is use Readonly; Readonly my $EMPTY_STRING => q<>; $year = $EMPTY_STRING;