Perl-Toolchain-Gang / CPAN-Meta-Requirements

a set of version requirements for a CPAN dist
5 stars 15 forks source link

Ignore alpha in version comparison #26

Closed miyagawa closed 9 years ago

miyagawa commented 9 years ago

re: https://github.com/miyagawa/cpanminus/issues/463

CPAN::Meta::Requirements internally uses version.pm for comparing versions, and it tends to have issues with underscore/alpha in versions.

use CPAN::Meta::Requirements;
warn CPAN::Meta::Requirements
  ->from_string_hash({ Foo => "1.23" })
  ->accepts_module("Foo", "1.2_3"); # undef

Fixing it in core/version.pm is another issue, but maybe we can relax CMR to normalize the version before comparing it in version.pm. Note that version.pm's normalize function might have issues by itself, such as: https://rt.cpan.org/Public/Bug/Display.html?id=98744

dagolden commented 9 years ago

I'm very reluctant to have CMR pass anything that might fail at runtime.

E.g. (not tested, but you'll see what I mean)

package Foo;
our $VERSION = version->new("v1.2.3_4");
use Foo v1.2.3.4
miyagawa commented 9 years ago

Yeah I was about to point that "this shouldn't be an error if you weren't using version" - and got the result as you suggest. So that's fair enough.