Skip Menu |

This queue is for tickets about the Perl-Critic-Pulp CPAN distribution.

Report information
The Basics
Id: 92100
Status: resolved
Priority: 0/
Queue: Perl-Critic-Pulp

People
Owner: Nobody in particular
Requestors: dmacks [...] netspace.org
Cc:
AdminCc:

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



Subject: Fails t/ConstantLeadingUnderscore.t and t/ConstantPragmaHash.t
Date: Mon, 13 Jan 2014 04:18:42 -0500
To: bug-Perl-Critic-Pulp [...] rt.cpan.org
From: "Daniel Macks" <dmacks [...] netspace.org>
Building Perl-Critic-Pulp-80 on OS X 10.8 against Apple's perl5.12.4 and all dependencies up-to-date at/near current CPAN versions... t/ConstantLeadingUnderscore.t ...... 45/75 Invalid version format (non-numeric data) at /sw/build.build/perl-critic-pulp-pm5124-80-1/Perl-Critic-Pulp-80/blib/lib/Perl/Critic/Policy/Compatibility/ConstantLeadingUnderscore.pm line 73. # Looks like you planned 75 tests but ran 52. # Looks like your test exited with 255 just after 52. t/ConstantLeadingUnderscore.t ...... Dubious, test returned 255 (wstat 65280, 0xff00) Failed 23/75 subtests t/ConstantPragmaHash.t ............. 33/61 Invalid version format (non-numeric data) at /sw/build.build/perl-critic-pulp-pm5124-80-1/Perl-Critic-Pulp-80/blib/lib/Perl/Critic/Policy/Compatibility/ConstantPragmaHash.pm line 69. # Looks like you planned 61 tests but ran 37. # Looks like your test exited with 255 just after 37. t/ConstantPragmaHash.t ............. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 24/61 subtests I see the same reported on the cpan-testers matrix for some platforms. dan -- Daniel Macks dmacks@netspace.org
CC: bug-Perl-Critic-Pulp [...] rt.cpan.org
Subject: Re: [rt.cpan.org #92100] Fails t/ConstantLeadingUnderscore.t and t/ConstantPragmaHash.t
Date: Thu, 16 Jan 2014 09:32:39 +1100
To: dmacks [...] netspace.org
From: Kevin Ryde <user42 [...] zip.com.au>
"dmacks@netspace.org via RT" <bug-Perl-Critic-Pulp@rt.cpan.org> writes: Show quoted text
> > t/ConstantLeadingUnderscore.t ...... 45/75 Invalid version format (non-numeric data) at /sw/build.build/perl-critic-pulp-pm5124-80-1/Perl-Critic-Pulp-80/blib/lib/Perl/Critic/Policy/Compatibility/ConstantLeadingUnderscore.pm line 73.
Thanks. Hmm. That'll be $ver = version->new ($ver); I wonder what it doesn't like. Could I trouble you to put in a print to see what is $ver at the failing time. It should be 1.01 or something like that, which version.pm should accept. $ver is a PPI::Token::Number::Float object rather than a plain scalar. That's worked for me but I wonder if that version.pm doesn't like it. Maybe it would enjoy more $ver = version->new ($ver->content); Show quoted text
> I see the same reported on the cpan-testers matrix for some platforms.
Oh I hadn't seen those. (There was some ppi and perlcritic stuff cluttering up the fails lately.) -- Is it about the hedge?
Subject: Re: [rt.cpan.org #92100] Fails t/ConstantLeadingUnderscore.t and t/ConstantPragmaHash.t
Date: Thu, 16 Jan 2014 01:00:57 -0500
To: bug-Perl-Critic-Pulp [...] rt.cpan.org
From: "Daniel Macks" <dmacks [...] netspace.org>
It actually might be worse. From the dist dir after running Makefile.PL (and make, and 'make install' just to be sure there was no older version contaminating), I tried manually running just ConstantLeadingUnderscore.t verbosely... PERL_DL_NONLAZY=1 /usr/bin/arch -x86_64 perl5.12 "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(1, 'blib/lib', 'blib/arch')" t/ConstantLeadingUnderscore.t t/ConstantLeadingUnderscore.t .. 1..75 ok 1 - VERSION variable ok 2 - VERSION class method ok 3 - VERSION class check 80 ok 4 - VERSION class check 1080 ok 5 - str: use constant ok 6 - str: use constant 1.00 ok 7 - str: use constant; ok 8 - str: use constant 1.00; ok 9 - str: use constant 1.03 ok 10 - str: use constant 1.00 1.03 ok 11 - str: use constant 1.03; ok 12 - str: use constant 1.00 1.03; ok 13 - str: use constant 'FOO', 123 ok 14 - str: use constant 1.00 'FOO', 123 ok 15 - str: use constant 'FOO', 123; ok 16 - str: use constant 1.00 'FOO', 123; ok 17 - str: use constant "FOO", 123 ok 18 - str: use constant 1.00 "FOO", 123 ok 19 - str: use constant "FOO", 123; ok 20 - str: use constant 1.00 "FOO", 123; ok 21 - str: use constant q{FOO}, 123 ok 22 - str: use constant 1.00 q{FOO}, 123 ok 23 - str: use constant q{FOO}, 123; ok 24 - str: use constant 1.00 q{FOO}, 123; ok 25 - str: use constant qq{FOO}, 123 ok 26 - str: use constant 1.00 qq{FOO}, 123 ok 27 - str: use constant qq{FOO}, 123; ok 28 - str: use constant 1.00 qq{FOO}, 123; ok 29 - str: use constant FOO => 123 ok 30 - str: use constant 1.00 FOO => 123 ok 31 - str: use constant FOO => 123; ok 32 - str: use constant 1.00 FOO => 123; not ok 33 - str: use constant qw(FOO 123) # TODO qw() not handled yet #   Failed (TODO) test 'str: use constant qw(FOO 123)' #   at t/ConstantLeadingUnderscore.t line 84. #          got: undef #     expected: 'FOO' not ok 34 - str: use constant 1.00 qw(FOO 123) # TODO qw() not handled yet #   Failed (TODO) test 'str: use constant 1.00 qw(FOO 123)' #   at t/ConstantLeadingUnderscore.t line 84. #          got: undef #     expected: 'FOO' not ok 35 - str: use constant qw(FOO 123); # TODO qw() not handled yet #   Failed (TODO) test 'str: use constant qw(FOO 123);' #   at t/ConstantLeadingUnderscore.t line 84. #          got: undef #     expected: 'FOO' not ok 36 - str: use constant 1.00 qw(FOO 123); # TODO qw() not handled yet #   Failed (TODO) test 'str: use constant 1.00 qw(FOO 123);' #   at t/ConstantLeadingUnderscore.t line 84. #          got: undef #     expected: 'FOO' ok 37 - str: use constant {x=>1} ok 38 - str: use constant 1.00 {x=>1} ok 39 - str: use constant {x=>1}; ok 40 - str: use constant 1.00 {x=>1}; ok 41 - str: use constant { qw(x 1) } ok 42 - str: use constant 1.00 { qw(x 1) } ok 43 - str: use constant { qw(x 1) }; ok 44 - str: use constant 1.00 { qw(x 1) }; ok 45 - single policy Compatibility::ConstantLeadingUnderscore ok 46 - VERSION object check 80 ok 47 - VERSION object check 1080 ok 48 - str: use constant FOO => 1; ok 49 - str: use constant _FOO => 1; ok 50 - str: use 5.005; use constant FOO => 1; ok 51 - str: use 5.005; use constant _FOO => 1; ok 52 - str: use 5.006; use constant _FOO => 1; Invalid version format (non-numeric data) at /sw/build.build/perl-critic-pulp-pm5124-80-1/Perl-Critic-Pulp-80/blib/lib/Perl/Critic/Policy/Compatibility/ConstantLeadingUnderscore.pm line 73. # Looks like you planned 75 tests but ran 52. # Looks like your test exited with 255 just after 52. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 23/75 subtests So the dubious sitaution around line 73 is just a visible diagnostic even in quiet mode (and that may cause early giving up), compared to even earlier real failures. For what it's worth, I have the latest (CPAN) modules: constant-1.27 version-0.9907 dan -- Daniel Macks dmacks@netspace.org
CC: bug-Perl-Critic-Pulp [...] rt.cpan.org
Subject: Re: [rt.cpan.org #92100] Fails t/ConstantLeadingUnderscore.t and t/ConstantPragmaHash.t
Date: Fri, 17 Jan 2014 09:40:31 +1100
To: dmacks [...] netspace.org
From: Kevin Ryde <user42 [...] zip.com.au>
"dmacks@netspace.org via RT" <bug-Perl-Critic-Pulp@rt.cpan.org> writes: Show quoted text
> > So the dubious sitaution around line 73 is just a visible diagnostic > even in quiet mode (and that may cause early giving up), compared to > even earlier real failures.
"Failed (TODO)" means tests not meant to pass yet. I could have commented them out to avoid confusion. Show quoted text
> For what it's worth, I have the latest > (CPAN) modules: constant-1.27 version-0.9907
Hmm. I can't provoke it with that version.pm under perl 5.18.1. Did the print $ver or the $ver->content bit I suggested help or show anything?
From: ppisar [...] redhat.com
Dne Čt 16.led.2014 17:40:50, user42@zip.com.au napsal(a): Show quoted text
> > For what it's worth, I have the latest > > (CPAN) modules: constant-1.27 version-0.9907
> > Hmm. I can't provoke it with that version.pm under perl 5.18.1. Did > the print $ver or the $ver->content bit I suggested help or show > anything?
Here $ver, $ver->content, $ver->literal, and Dumper($ver): ok 52 - str: use 5.006; use constant _FOO => 1; DEBUG: <1.01> content=<1.01> literal=<1.01> $VAR1 = bless( { 'content' => '1.01', '_location' => [ 1, 14, 14, 1, undef ] }, 'PPI::Token::Number::Float' ); Invalid version format (non-numeric data) at /home/petr/fedora/perl-Perl-Critic-Pulp/Perl-Critic-Pulp-80/lib/Perl/Critic/Policy/Compatibility/ConstantLeadingUnderscore.pm line 75. # Looks like you planned 75 tests but ran 52. This is incompatibility between version and PPI::Token::Number::Float: $ perl -e 'use version; use PPI::Token::Number::Float; $a=PPI::Token::Number::Float->new(q{1.01}); version->new($a)' Invalid version format (non-numeric data) at -e line 1. The $ver and $ver->content returns string, while version->new() expects float. One should use version->parse(). version has changes some
From: ppisar [...] redhat.com
Dne Čt 03.dub.2014 07:59:32, ppisar napsal(a): Show quoted text
> $ perl -e 'use version; use PPI::Token::Number::Float; > $a=PPI::Token::Number::Float->new(q{1.01}); version->new($a)' > Invalid version format (non-numeric data) at -e line 1. > > The $ver and $ver->content returns string, while version->new() > expects float. One should use version->parse(). > version has changes some
Actually $ver is reference which is not handled by version->new() or version->parse() anymore. One has to coerce it to a string or a number: $a=PPI::Token::Number::Float->new(q{1.01}); $v=version->parse("$a");
From: ppisar [...] redhat.com
Dne Po 13.led.2014 04:18:52, dmacks@netspace.org napsal(a): Show quoted text
> Building Perl-Critic-Pulp-80 on OS X 10.8 against Apple's perl5.12.4 > and all dependencies up-to-date at/near current CPAN versions... > > t/ConstantLeadingUnderscore.t ...... 45/75 Invalid version format > (non-numeric data) at /sw/build.build/perl-critic-pulp-pm5124-80- > 1/Perl-Critic-Pulp- > 80/blib/lib/Perl/Critic/Policy/Compatibility/ConstantLeadingUnderscore.pm > line 73. > # Looks like you planned 75 tests but ran 52. > # Looks like your test exited with 255 just after 52. > t/ConstantLeadingUnderscore.t ...... Dubious, test returned 255 (wstat > 65280, 0xff00) > Failed 23/75 subtests > t/ConstantPragmaHash.t ............. 33/61 Invalid version format > (non-numeric data) at /sw/build.build/perl-critic-pulp-pm5124-80- > 1/Perl-Critic-Pulp- > 80/blib/lib/Perl/Critic/Policy/Compatibility/ConstantPragmaHash.pm > line 69. > # Looks like you planned 61 tests but ran 37. > # Looks like your test exited with 255 just after 37. > t/ConstantPragmaHash.t ............. Dubious, test returned 255 (wstat > 65280, 0xff00) > Failed 24/61 subtests >
Attached patch fixes it. -- Petr
Subject: 0001-Pass-string-to-version-new.patch
From 8d22c0d3cae7eb6985e4e401484a2b7717314c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Thu, 3 Apr 2014 14:28:25 +0200 Subject: [PATCH] Pass string to version->new() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 0.9907 version's new() does not accept PPI objects. Pass literal PPI values instead. <https://rt.cpan.org/Public/Bug/Display.html?id=92100> Signed-off-by: Petr Písař <ppisar@redhat.com> --- lib/Perl/Critic/Policy/Compatibility/ConstantLeadingUnderscore.pm | 2 +- lib/Perl/Critic/Policy/Compatibility/ConstantPragmaHash.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Perl/Critic/Policy/Compatibility/ConstantLeadingUnderscore.pm b/lib/Perl/Critic/Policy/Compatibility/ConstantLeadingUnderscore.pm index 6ac4c79..a9bbbbd 100644 --- a/lib/Perl/Critic/Policy/Compatibility/ConstantLeadingUnderscore.pm +++ b/lib/Perl/Critic/Policy/Compatibility/ConstantLeadingUnderscore.pm @@ -70,7 +70,7 @@ sub violates { ($inc->module||'') eq 'constant' || next; if (my $ver = Perl::Critic::Pulp::Utils::include_module_version ($inc)) { - $ver = version->new ($ver); + $ver = version->new ($ver->literal); if (! defined $modver || $ver > $modver) { $modver = $ver; diff --git a/lib/Perl/Critic/Policy/Compatibility/ConstantPragmaHash.pm b/lib/Perl/Critic/Policy/Compatibility/ConstantPragmaHash.pm index 4e976b5..c942fe4 100644 --- a/lib/Perl/Critic/Policy/Compatibility/ConstantPragmaHash.pm +++ b/lib/Perl/Critic/Policy/Compatibility/ConstantPragmaHash.pm @@ -66,7 +66,7 @@ sub violates { ($inc->module||'') eq 'constant' || next; if (my $ver = Perl::Critic::Pulp::Utils::include_module_version ($inc)) { - $ver = version->new ($ver); + $ver = version->new ($ver->literal); if (! defined $modver || $ver > $modver) { $modver = $ver; -- 1.9.0
Thanks. I made that change, though using ->content instead of ->literal because I think perl itself interprets as a string in those contexts, not with the mangling PPI's ->literal might apply. Version 81 should be better with luck (missed an entry in the Changes file, but is in the code :-). (Dunno why version->new doesn't simply stringize anything it gets. It can cause problems like this if it's enquiring too much into the nature of its arg.)