Subject: | Version comparison does not match version module behavior. |
Consider test program:
#!/usr/bin/perl
use strict;
use warnings;
use version 0.77;
use Perl::Version;
use Test::More;
my $v1 = 'v0.10.1_01';
my $v2 = 'v0.10.2';
is( Perl::Version->new( $v1 ) <=> $v2, version->parse( $v1 ) <=> $v2 );
done_testing;
exit( 0 );
With version 0.9912, it passes:
ok 1
1..1
With version 0.9913 (an later), it fails:
not ok 1
# Failed test at test.t line 12.
# got: '-1'
# expected: '1'
1..1
# Looks like you failed 1 test of 1.
version 0.9912 interprets 'v0.10.1_01' as 'v0.10.1.1' (+alpha flag), but version 0.9913 interprets it is 'v0.10.101' (+alpha flag).
The change in version module is intentional (I guess it is because Perl interprets v-string v0.10.1_01 as v0.10.101) so it unlikely to be reverted. That means Perl::Version should adopt new version behavior to be compatible with version module.