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

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

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



Subject: perlcritic fails with filename 0
If the input file is called 0 then perlcritic always reports it is okay, even if it contains errors. % cat test #!/usr/bin/perl # $Id$ use warnings; use strict; use 5.010; say 'hello'; % perlcritic -1 test No "VERSION" variable found at line 1, column 1. See page 404 of PBP. (Severity: 2) % mv test 0 % perlcritic -1 0 0 source OK (Some perlcritic tests for catching this kind of bug would be very welcome...)
Subject: Re: [rt.cpan.org #36127] perlcritic fails with filename 0
Date: Sat, 21 Jun 2008 08:14:29 -0700
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Fix checked in. However, it still won't work because the current version of PPI won't handle it. At this point, if you attempt this, perlcritic will emit: Problem while critiquing "0": Can't parse code: Did not provide a file name to load So, not only will you need the next version of Perl::Critic, you'll need the next version of PPI.
Subject: Re: [rt.cpan.org #36127] perlcritic fails with filename 0
Date: Sun, 22 Jun 2008 11:01:37 -0700
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Fix released in 1.087.
It seems that the current development release of PPI, 1.204_01, is still buggy.
Subject: Re: [rt.cpan.org #36127] perlcritic fails with filename 0
Date: Sun, 07 Sep 2008 16:44:59 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
EDAVIS via RT wrote: Show quoted text
> It seems that the current development release of PPI, 1.204_01, is still > buggy.
Yes, this change hasn't been released yet. You'll have to bother Adam to get it released.
Subject: Re: [rt.cpan.org #36127] perlcritic fails with filename 0
Date: Sun, 07 Sep 2008 16:59:16 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Elliot Shank via RT wrote: Show quoted text
> EDAVIS via RT wrote:
>> It seems that the current development release of PPI, 1.204_01, is still >> buggy.
> > Yes, this change hasn't been released yet. You'll have to bother Adam to get it released.
http://svn.ali.as/cpan/trunk/PPI/Changes
On Sun Sep 07 17:59:37 2008, clonezone wrote: Show quoted text
> Elliot Shank via RT wrote:
> > EDAVIS via RT wrote:
> >> It seems that the current development release of PPI, 1.204_01, is
> still
> >> buggy.
> > > > Yes, this change hasn't been released yet. You'll have to bother
> Adam to get it released. > > http://svn.ali.as/cpan/trunk/PPI/Changes
I don't know when all the pieces/parts came together, but it appears to me that Perl::Critic 1.105 and PPI 1.208 can critique a file named '0'.
Show quoted text
>Perl::Critic 1.105 and PPI 1.208 can critique a file named '0'.
Confirmed. Thanks to everyone who worked on this. Bugs relating to the string '0' are very common in Perl code, and it would be most handy for perlcritic to detect them. However I fear that doing so would require difficult static analysis, or else runtime warnings when 'stringy' values such as filenames are used in boolean context.
On Mon Jan 25 09:37:05 2010, EDAVIS wrote: Show quoted text
> >Perl::Critic 1.105 and PPI 1.208 can critique a file named '0'.
> > Confirmed. Thanks to everyone who worked on this. > > Bugs relating to the string '0' are very common in Perl code, and it > would be most handy for perlcritic to detect them. However I fear that > doing so would require difficult static analysis, or else runtime > warnings when 'stringy' values such as filenames are used in boolean > context. > >
My notes say this was actually fixed in PPI 1.206. Anyhow, glad it works. As for string '0', I agree that '0' is a problem, but am unable to imagine how to write a static test for it, without having a Vulcan::Mind::Meld package to figure out what the intent of the author was when writing a given test. Even given Perl 5.010, I don't think you can willy-nilly presume that the author meant '//' when he or she wrote '||'.