Skip Menu |

This queue is for tickets about the version CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

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



Subject: numify() returns unnecessary second triple
CPAN RT#64635 resolved that: The "numify" operator has returned trailing zeros (in multiples of 3) since March 2006 and the POD never got updated. The documentation was updated to: numify() Returns a value representing the object in a pure decimal form without trailing zeroes. version->declare('v1.2')->numify; # 1.002 version->parse('1.2')->numify; # 1.200 Yet 0.9918 version (the XS code) returns useless second 000 triplet: $ perl -Iblib/{lib,arch} -Mversion -e 'print version->parse('v1.2')->numify, qq{$a\n}' 1.002000 This violates the documentation. I have two proposals: (1) If this (code or documentation) is a bug it should be fixed. (2) The "without trailing zeroes" documentation is misleading as 1.200 has clearly trailing zeros. It should be worded better to describe the triples. Maybe both issues could be simply fixed by removing the "without trailing zeroes" from the documentation leaving the number of trailing zeros an implementation detail. At the end the meaning of numify() is to return a number (as opposed to version dotted string).
From: ppisar [...] redhat.com
Dne Po 21.srp.2017 09:16:54, ppisar napsal(a): Show quoted text
> Maybe both issues could be simply fixed by removing the "without > trailing zeroes" from the documentation leaving the number of trailing > zeros an implementation detail. At the end the meaning of numify() is > to return a number (as opposed to version dotted string).
An attached patch does exactly it. It changes numify() and stringify() examples to match how to code behaves.
Subject: version-0.9918-doc_numify_stringify_trailing_zeros.patch
This corrects numify() and stringify() documentation to match code bahavior that exists for ages. CPAN RT#64635 CPAN RT#122858 diff -r 2e2892f29539 lib/version.pod --- a/lib/version.pod Sun May 29 07:50:12 2016 -0400 +++ b/lib/version.pod Fri Mar 09 14:38:36 2018 +0100 @@ -266,10 +266,9 @@ =head2 numify() -Returns a value representing the object in a pure decimal form without -trailing zeroes. +Returns a value representing the object in a pure decimal. - version->declare('v1.2')->numify; # 1.002 + version->declare('v1.2')->numify; # 1.002000 version->parse('1.2')->numify; # 1.200 =head2 stringify() @@ -280,7 +279,7 @@ a version object is interpolated into a string. version->declare('v1.2')->stringify; # v1.2 - version->parse('1.200')->stringify; # 1.200 + version->parse('1.200')->stringify; # 1.2 version->parse(1.02_30)->stringify; # 1.023 =head1 EXPORTED FUNCTIONS
Will be released in 0.9921 (soonish)