Re: Version comparisons

[email protected] (Brian Ingerson) Thu, 30 Oct 2003 11:23:07 -0800
Newsgroups perl.cpan.metadata
Message-ID <[email protected]>
On 29/10/03 10:58 -0000, Jos Boumans wrote:
> Greetings,
> 
> We're running in to problems now with version comparisons;
> 
> EU::MM, Version, Module::Build and CPAN(PLUS) all have their own
> code to compare versions. Sadly, they're not always 100% the same
> which can cause discrepancies. But even more so, Module::Build has
> a much more extensive way of comparing versions and prerequisites
> than any of the other tools.
> 
> Right now, we're lacking a standard and a clear definition of how 
> versions should be compared, written down and specified.
> 
> To be able to reliably, and cross-module compare versions, we need to 
> come up with a standard for doing this. I personally like the way M::B 
> has solved it, but it's not something we can easily emulate.
> Also, my gut feeling says that version comparison is somethign that 
> belongs in version.PM.
> 
> Autrijus proposed a syntax like this:
> 	version->new('1.403')->satisfy('> 1.10 != 1.40');
> 		or
> 	version->new('1.403')->match('> 1.10 != 1.40');

FWIW, only.pm uses a simple range specification like this:

   '0.30-0.50 !0.36 0.55-0.75 !0.57-0.59 0.88 0.91 0.95-'

Which consists of:

   * single versions
   * version ranges
   * negations of singletons or ranges

and:
   * ranges can be open ended on either side
   * singletons and ranges have an implied OR before them
   * negations have an implied AND before them

I find it to be a very simple syntax for easily expressing any version set.

Cheers, Brian