logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: Major change in version object behavior: msg#00081

Subject: Re: Major change in version object behavior
On Sun, Apr 17, 2005 at 07:21:55PM -0400, John Peacock wrote:
> Numeric versions - any version which contains only a single decimal point;
> Quoted versions - any version which contains more than one decimal point or 
> has a leading 'v' character (the "v-string" form).
> 
> My proposal is that for Numeric versions (basically everything on CPAN 
> currently), the stringified output is always exactly the same as the 
> numified output, i.e. always something that looks like a floating point 
> number.
> 
> On the other hand, Quoted versions will always output in a reduced normal 
> form, with a leading 'v' character and a minimum of two decimal points.  
> This has the unfortunate side effect that on any Perl < 5.8.1, this form 
> will not be able to "round-trip" safely, e.g.
> 
>       $v1 = version->("1.2.3");
>       $v2 = "$v1";
>       print "$v1 != $v2\n"; # prints "v1.2.3 != \1\2\3" for 5.6.0 - 5.8.0
> 
> but I think this is the only sane behavior.  From what I've seen of Perl6, 
> it appears that Larry is intending to take the leading 'v' behavior and 
> assign it to a version object (thus abandoning the v-string behavior).
> 
> So the rules are:
> 
> 1) If a version object is initialized with a floating point value, it will 
> stringify as a floating point value;
> 
> 2) If a version object is initialized with leading 'v' or contains more 
> than one decimal, it will always stringify in the reduced normal form (with 
> a leading 'v' and at least two decimals).
> 
> Thoughts???

Which rule does:
  $VERSION = '0.27_01';
  $VERSION = eval $VERSION;

  print "$VERSION";
result in?



<Prev in Thread] Current Thread [Next in Thread>