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

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

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



Subject: Non-numeric value warning for 'use 5.010_000;'
This problem appeared when a file, tools/dev/branch_status.pl, was recently added to the Parrot distribution. The program, written (unlike most code in Parrot) in Perl 5.10, starts with this code: use 5.010_000; use strict; use warnings; use feature(); When we run this file through our t/codingstd/perlcritic.t, we get the following output: $ perl t/codingstd/perlcritic.t tools/dev/branch_status.pl 1..1 Argument "5.010_000" isn't numeric in subroutine entry at /usr/local/lib/perl5/site_perl/5.10.0/Perl/Critic/Document.pm line 139. ok 1 - Test::Perl::Critic for "tools/dev/branch_status.pl" Examining Perl::Critic::Document in the specified area, I see this code: sub highest_explicit_perl_version { my ($self) = @_; my $highest_explicit_perl_version = $self->{_highest_explicit_perl_version}; if ( not exists $self->{_highest_explicit_perl_version} ) { my $includes = $self->find( \&_is_a_version_statement ); if ($includes) { $highest_explicit_perl_version = max map { version->new( $_->version() ) } @{$includes}; } #... } Line 139 is: max map { version->new( $_->version() ) } @{$includes}; List::Util::max() is documented as follows: max LIST Returns the entry in the list with the highest numerical value. If the list is empty then "undef" is returned. I suspect that 'version->new' is somehow delivering a non-numeric value to 'max'. However, when I rewrite the version specification as: use v5.10.0; ... our coding standards test passes. Is this a bug in Perl::Critic::Document's use of 'max' or 'version' -- or are we doing something wrong? Thank you very much. Jim Keenan
Subject: Re: [rt.cpan.org #45892] Non-numeric value warning for 'use 5.010_000;'
Date: Sat, 09 May 2009 14:04:01 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
James E Keenan via RT wrote: Show quoted text
> use 5.010_000;
[chop] Show quoted text
> I suspect that 'version->new' is somehow delivering a non-numeric value > to 'max'.
[chop] Show quoted text
> However, when I rewrite the version specification as: > > use v5.10.0; > > ... our coding standards test passes. > > Is this a bug in Perl::Critic::Document's use of 'max' or 'version' -- > or are we doing something wrong?
Yes, version.pm returns "5.010_000" for this case, which, outside of code compilation, isn't considered numeric by perl. The opinion has been that using underscores in version numbers indicates a developer version, which perl 5.010000 is not.
On Sat May 09 15:04:23 2009, clonezone wrote: Show quoted text
> > Yes, version.pm returns "5.010_000" for this case, which, outside of > code compilation, isn't considered numeric by perl. The opinion > has been that using underscores in version numbers indicates a > developer version, which perl 5.010000 is not.
Elliot, thanks for the rapid response. I confirmed that 'use 5.010000;' would pass our test. Since this is a quirk of version.pm rather than Perl::Critic, I'm satisfied and am marking this ticket resolved. Jim Keenan