On Mon, Jul 12, 2010 at 7:08 AM, David Cantrell <[email protected]> wrote:
> 2.17.1 isn't a version *number* at all as it isn't a number.  It is a
> higher *version* than 2.6.
>
> I suppose this exposes another bug: that you can compare different data
> types (in this case a number and a version) without an explicit cast :-)

For the record, CPAN::Reporter uses CPAN::Version for comparisons and
that does the best job I think anything can do short of using
version.pm to compare things.

The best way to compare module "versions" is this:

    use version;

    if ( version->parse($a) > version->parse($b) ) { ... }

The problem is this case is one of how the author specified the prereq.

I have ranted in many other forums that dotted decimal versions should
always be expressed in "normal" form -- meaning a leading v and at
least 3 parts (v2.17.1 or v2.6.0) to avoid confusion.

But nothing prevents an author from specifying v2.6.0 as "2.6" with
the result we have seen.  "2.6.0" or even "v2.6" would have had the
right comparison.

-- David

Reply via email to