v0.6 != v0.6.0 ?

Matt Lawrence matt.lawrence at virgin.net
Tue Oct 18 11:51:03 BST 2011


On 18/10/11 11:19, Chisel wrote:
> Is this expected behaviour? I get lost in what versions should and shouldn't
> numify. It definitely doesn't DWIM.
>
> ➔ perl -Mversion -le '$big=version->new("0.6.99");
> $small=version->new("0.6"); print $big; print $small; print
> $big>$small ? "ok":"wuh?"'
> 0.6.99
> 0.6
> wuh?
>
> ➔ perl -Mversion -le '$big=version->new("0.6.99");
> $small=version->new("0.6.0"); print $big->numify; print $small; print
> $big>$small ? "ok":"wuh?"'
> 0.006099
> 0.6.0
> ok
>
> ➔ perl -Mversion -le '$big=version->new("0.6.99");
> $small=version->new("0.6"); print $big->numify; print $small->numify;
> print $big>$small ? "ok":"wuh?"'
> 0.006099
> 0.600
> wuh?
*
*Docs imply that "Decimal" and "Dotted decimal" version strings are 
treated differently, where "dotted decimal" versions have 3 or more parts.

Perhaps the "declare" method (instead of new()) will yield more 
intuitive results..

perl -Mversion -le '$big=version->declare("0.6.99");
$small=version->declare("0.6"); print $big; print $small; print
$big>$small ? "ok":"wuh?"'
0.6.99
v0.6
ok

Matt



More information about the london.pm mailing list