Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RT #119447: Version comparison does not match version module behavior. #8

Closed
briandfoy opened this issue Jan 4, 2024 · 1 comment
Closed
Assignees
Labels
imported by rt.cpan.org issues from the old tracker Status: rejected this change is rejected Type: bug an existing feature does not work

Comments

@briandfoy
Copy link
Owner

From VDB in #119447 on rt.cpan.org:

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.

@briandfoy briandfoy self-assigned this Jan 4, 2024
@briandfoy briandfoy added Status: needs verification issue needs to be verified Priority: low get to this whenever imported by rt.cpan.org issues from the old tracker labels Jan 4, 2024
@briandfoy
Copy link
Owner Author

I added t/99.rt-119447.t to check this. The Perl::Version module is acting correctly. The version of v0.10.1_01 is less than v0.10.2.

As you say this is a problem in version.pm, but Perl::Version is correct. If people want version.pm semantics, they can use version.pm.

@briandfoy briandfoy added Type: bug an existing feature does not work Status: rejected this change is rejected and removed Status: needs verification issue needs to be verified Priority: low get to this whenever labels Jan 4, 2024
briandfoy added a commit that referenced this issue Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported by rt.cpan.org issues from the old tracker Status: rejected this change is rejected Type: bug an existing feature does not work
Projects
None yet
Development

No branches or pull requests

1 participant