Skip Menu |

This queue is for tickets about the version CPAN distribution.

Report information
The Basics
Id: 19017
Status: resolved
Priority: 0/
Queue: version

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

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



Subject: problems with 0.0.x versions
Requiring Foo 0.0.8 when 0.0.4 is installed (which should fail) prints the following warning: Version string '8e-06' contains invalid data; ignoring: '8e-06' at ./test.pl line 5. and then succeeds. Code: #main use version; use Foo 0.0.8; #Foo.pm package Foo; use strict; use version; our $VERSION = qv(0.0.4); 1;
On Mon May 01 16:35:47 2006, MSCHILLI wrote: Show quoted text
> #main > use version; > use Foo 0.0.8;
See this note: http://annocpan.org/~JPEACOCK/version-0.59/lib/version.pod#note_743 The second parameter to 'use' is (by default) default interpreted as a bare number, which defeats whatever magic version.pm is able to do. By forcing the interpretation to be a version object with qv(), you can get around that problem. HTH John
On Mon May 01 16:42:11 2006, JPEACOCK wrote: Show quoted text
No luck, try this: # Foo.pm package Foo; use strict; use version; our $VERSION = qv(0.0.4); 1; # test.pl use version; use Foo qv("0.0.8");
Subject: Re: [rt.cpan.org #19017] problems with 0.0.x versions
Date: Tue, 02 May 2006 10:53:21 -0400
To: bug-version [...] rt.cpan.org
From: John Peacock <jpeacock [...] rowman.com>
Michael_Schilli via RT wrote: Show quoted text
> No luck, try this: > > # Foo.pm > package Foo; > use strict; > use version; > our $VERSION = qv(0.0.4); > 1; > > # test.pl > use version; > use Foo qv("0.0.8");
Hmmm, it's trickier that I thought at first glance. It's actually related to how 'use' treats terms after the module name and specifically, whether that next term looks like a specific kind of number (e.g. one starting with 0). If you make those examples above equal to 1.0.4 and 1.0.8 (without the qv() on the 'use' line), it correctly gives the message: Foo version 1.000008 (v1.0.8) required--this is only version 1.000004 (v1.0.4) at t.pl line 2. BEGIN failed--compilation aborted at t.pl line 2. (except with Perl 5.005_04, see below). IIF the term following the modulename in 'use' and 'require' look like a number, then for some values of Perl (again 5.005_04 always misfires), then the inherited Exporter::import method will internally call UNIVERSAL::VERSION on the module's behalf. However, if the leading digit is 0, the tokenizer messes with the number before passing and you get the error you originally noted. For now, the AnnoCPAN entry is wrong; I can fix that by providing an import() method to version.pm (which means I can do what I want for most values of Perl). As soon as I have something to test, I'll shoot you a note... John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4501 Forbes Boulevard Suite H Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5748
CC: MSCHILLI [...] cpan.org
Subject: Re: [rt.cpan.org #19017] problems with 0.0.x versions
Date: Tue, 2 May 2006 09:27:27 -0700 (PDT)
To: John Peacock via RT <bug-version [...] rt.cpan.org>
From: Mike Schilli <m [...] perlmeister.com>
On Tue, 2 May 2006, John Peacock via RT wrote: Show quoted text
> For now, the AnnoCPAN entry is wrong; I can fix that by providing an > import() method to version.pm (which means I can do what I want for most > values of Perl). As soon as I have something to test, I'll shoot you a > note...
Great! One thing I'd like to add (and I added it as a comment to rt.cpan.org twice, but comments don't seem to stick) is that it behaves differently on perl 5.6.1 and 5.8. On 5.6.1, it throws an error: ./test.pl "v0.0.8" is not exported by the Foo module at ./test.pl line 3 Can't continue after import errors at ./test.pl line 3 BEGIN failed--compilation aborted at ./test.pl line 3. while on 5.8 it silently accepts a missing prerequisite. Given your explanation, this might be non-trivial to fix, but I'd be happy to test anything you throw my way. Thanks ... -- Mike Mike Schilli m@perlmeister.com
Subject: Re: [rt.cpan.org #19017] problems with 0.0.x versions
Date: Wed, 03 May 2006 11:17:44 -0400
To: bug-version [...] rt.cpan.org
From: John Peacock <jpeacock [...] rowman.com>
Mike Schilli via RT wrote: Show quoted text
> Great! One thing I'd like to add (and I added it as a comment to > rt.cpan.org twice, but comments don't seem to stick) is that it behaves > differently on perl 5.6.1 and 5.8. On 5.6.1, it throws an error: > > ./test.pl > "v0.0.8" is not exported by the Foo module at ./test.pl line 3
That's a different error; if you use qv() after the 'use' line, it assumes this is supposed to be one of the @EXPORTS_OK items (to use Exporter-speak), and *not* a version comparison (which only works with bare numbers). I don't know how I am going to get around that (apart from inheriting version::import that DTRT). Show quoted text
> Can't continue after import errors at ./test.pl line 3 > BEGIN failed--compilation aborted at ./test.pl line 3.
OK, I'm on the trail of what is really going on with the original report. A while ago, I introduced code such that if the input to several of the ways that version objects could be created was a floating point number (NV), then I forced it into a string using sprintf() (since otherwise I would be dependent on the vagaries of how Perl does the conversion internally). Unfortunately, there doesn't appear to be a way to force sprintf() to produce a non-exponential representation once the number gets below 10**-5. I'm going to have to re-write the parser to handle exponential notation I'm afraid. John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4501 Forbes Boulevard Suite H Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5748
CC: MSCHILLI [...] cpan.org
Subject: Re: [rt.cpan.org #19017] problems with 0.0.x versions
Date: Wed, 3 May 2006 13:14:49 -0700 (PDT)
To: John Peacock via RT <bug-version [...] rt.cpan.org>
From: Mike Schilli <m [...] perlmeister.com>
On Wed, 3 May 2006, John Peacock via RT wrote: Show quoted text
> Unfortunately, there doesn't appear to be a way to force sprintf() to > produce a non-exponential representation once the number gets below > 10**-5. I'm going to have to re-write the parser to handle exponential > notation I'm afraid.
printf "%f\n", 0.000008; doesn't work? -- Mike Mike Schilli m@perlmeister.com
Subject: Re: [rt.cpan.org #19017] problems with 0.0.x versions
Date: Wed, 03 May 2006 17:08:19 -0400
To: bug-version [...] rt.cpan.org
From: John Peacock <jpeacock [...] rowman.com>
Mike Schilli via RT wrote: Show quoted text
> printf "%f\n", 0.000008; > > doesn't work? >
Yes, but for some reason that I'm not remembering, I've always used NVgf (equivalent to "%g") instead. Perhaps I can just switch to NVff instead and then the question becomes what fixed length I should use (currently 9) and whether I should worry about trailing zeros on non-extended version objects. John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4501 Forbes Boulevard Suite H Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5748
Subject: Re: [rt.cpan.org #19017] problems with 0.0.x versions
Date: Thu, 04 May 2006 22:27:14 -0400
To: bug-version [...] rt.cpan.org
From: John Peacock <jpeacock [...] rowman.com>
Mike Schilli via RT wrote: Show quoted text
> printf "%f\n", 0.000008; > > doesn't work?
It's all come back to me now. If I use "%.9f" (which I need to do to stomp on some floating point notation errors), I get trailing zeros, which make for really weird version objects. I've fixed this in the XS code now and need to just figure out how to do it in the pure Perl compatibility module. Expect something by the weekend. John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4720 Boston Way Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5747
On Thu May 04 22:27:51 2006, jpeacock@rowman.com wrote: Show quoted text
> Expect something by the weekend.
I neglected to update RT with the fact that I released version-0.59_02 to CPAN on Friday with a rewrite (and new tests) to fix this issue. If you can get a chance to test it, I'd appreciate it. I'll probably release 0.60 by this weekend if I don't hear anything bad... John
I've released 0.59_05 to CPAN with changes to your problem as well as more fixes (and synced it the to bleadperl code). I'll ship 0.60 in a few days if nothing else comes to light... Thanks for using the module (and taking the time to help make it better)! John