On Apr 16, 2008, at 3:50 PM, imacat wrote:
On Wed, 16 Apr 2008 22:00:05 +0200
[EMAIL PROTECTED] (Andreas J. Koenig) wrote:
It is a little known fact how decimal numbers convert to version
strings in perl. Frankly, I do not even know where it is documented.
% perl -le 'use version;print version->new("0.3") <=> version->new ("0.3.1");'
1
This means that 0.3 is higher than 0.3.1. To beat 0.3 with a versions

    I see.  I have filed an RT request (#35130) to Lingua-Features to
suggest a better version text naming.  But I think that it would be
great if 0.3.1 can be higher than 0.3, since that is natural to human
reading, and is the current practice of many open source projects.

I agree with that request in principle, but in reality it's too late. Reversing the ordering would break hundreds of other CPAN modules, not to mention perl itself. The easy way to remember it is that a second dot in a number triggers the elements of the version number to be split specially

  0.3   == 0.300000
  0.3.1 == 0.003001
  0.3.0 == 0.003000

And of course:

  perl 5.5.0  == 5.005
  perl 5.6.0  == 5.006
  perl 5.6.1  == 5.006001
  perl 5.10.0 == 5.010

Looking at the right hand side, the ordering becomes obvious. So, the common recommendation is to be 100% consistent with your version numbers. Either always use two dots or always use one dot or always use strings.

Chris

P.S. What does Perl 6 do?

Reply via email to