Subject: libperl-critic-perl: until block false-positive in hash key

From: Guillem Jover <[email-masked]>
Date: Sun, 28 Apr 2013 01:29:55 +0200

Package: libperl-critic-perl
Version: 1.118-1
Severity: normal

Hi!

I found the following false-positive while going through the dpkg code
base:

,--- until.pl ---
#!/usr/bin/perl

use strict;
use warnings;

our $VERSION = '0.00';

my %hash;

$hash{since}   = 0;
$hash{until}   = 1;
$hash{'until'} = 0;
`---

which gives:

  $ perlcritic --verbose 1 -1 until.pl
  until.pl:11:7:"until" block used

Thanks,
Guillem

---

From: Guillem Jover <[email-masked]>
Date: Tue, 30 Apr 2013 15:21:53 +0200

Hi!

>   until.pl:11:7:"until" block used

Actually, I missed an older instance that I had already marked to not
be criticized, here's the updated test case:

,--- until.pl ---
#!/usr/bin/perl

use strict;
use warnings;

our $VERSION = '0.00';

my %hash;
$hash{since}   = 0;
$hash{until}   = 1;
$hash{'until'} = 0;

sub func { }
func( { since   => 0, until => 1 } );
func( { until   => 1, since => 0 } );
func( { 'until' => 1, since => 0 } );
`---

And the violations:

  $ perlcritic --verbose 1 -1 until.pl
  until.pl:10:7:"until" block used
  until.pl:15:9:"until" block used

Thanks,
Guillem

---

From: Salvatore Bonaccorso <[email-masked]>
Date: Thu, 2 May 2013 21:52:13 +0200

Hi Guillem

> be criticized, here's the updated test case:

Thanks! Updated upstream bugtracker information.

Regards,
Salvatore