Subject: | version->parse(q[2.6_01])->normal gives v2_601.0 |
As reported by kentnl on IRC:
$ perl -Mversion -E 'say version->parse(q[2.6_01])->normal'
v2_601.0
--
Olivier Mengué - http://perlresume.org/DOLMEN
This queue is for tickets about the version CPAN distribution.
|
Subject: | version->parse(q[2.6_01])->normal gives v2_601.0 |
And as a result, it doesn't round-trip either:
perl -Mversion -E'say version->parse(version->parse(q[2.6_01])->normal)->normal'
Invalid version format (non-numeric data) at -e line 1.
On 2014-02-26 16:17:26, JPEACOCK wrote:
> On Tue Feb 25 20:54:57 2014, JPEACOCK wrote:
> > On Tue Feb 25 08:25:32 2014, KENTNL wrote:
> > > And as a result, it doesn't round-trip either:
> > >
> > > perl -Mversion -E'say
> > > version->parse(version->parse(q[2.6_01])->normal)->normal
> > > Invalid version format (non-numeric data) at -e line 1.
>
> Looking at this in detail, there is no possible way to convert that
> alpha string into an equivalent dotted-decimal form, let alone one
> that will round-trip. I've been regretting exposing normal() and
> numify() for years; I'm thinking of releasing 1.0.0 and removing those
> functions from the public API entirely.
>
> I'm rejecting this bug. I will not make this work. I /will/ make it
> an error to call normal() on a non-qv alpha version. That is the only
> sensible thing to do.
As a compromise, would you contemplate, an alternative where alpha bits are simply lost in normalizations?
Internal Perl doesn't care about Alpha anyway, and Alpha is only supposed to be human interface, not perl-interface detail.
Even if you have to pass a parameter to either support, or reject these, thats better than "oh, just die".
So in summary:
version->parse(q[2.6_01])->normal # should yield v2.601.0
version->parse(q[2.6_01])->normal( strict => 1 ) # could error
It just seems far less desirable to explode when normalising a perfectly valid perl version.
After all:
version->parse(q[2.6_01])->numify
Does not attempt to preserve the _
And
perl -Mversion -E 'say version->parse(version->parse(q[2.6_01])->numify)->normal'
v2.601.0
seems quite valid.
Subject: | Re: [rt.cpan.org #93340] version->parse(q[2.6_01])->normal gives v2_601.0 |
Date: | Sat, 01 Mar 2014 12:16:37 -0500 |
To: | bug-version [...] rt.cpan.org, undisclosed-recipients:; |
From: | John Peacock <john.peacock [...] havurah-software.org> |
Subject: | Re: [rt.cpan.org #93340] version->parse(q[2.6_01])->normal gives v2_601.0 |
Date: | Sun, 02 Mar 2014 10:43:06 -0500 |
To: | bug-version [...] rt.cpan.org, undisclosed-recipients:; |
From: | John Peacock <john.peacock [...] havurah-software.org> |