summaryrefslogtreecommitdiff
path: root/lib/CPAN/t/10version.t
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CPAN/t/10version.t')
-rw-r--r--lib/CPAN/t/10version.t11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/CPAN/t/10version.t b/lib/CPAN/t/10version.t
index c61ff0d91a..d1f8c3946d 100644
--- a/lib/CPAN/t/10version.t
+++ b/lib/CPAN/t/10version.t
@@ -21,6 +21,7 @@ print "1..$N\n";
my $has_sort_versions = eval { require Sort::Versions; 1 };
my $has_versionpm = eval { require version; 1 };
+my $has_perl_versionpm = eval { require Perl::Version; 1 };
while (@$D) {
my($l,$r,$exp) = @{shift @$D};
my $res = CPAN::Version->vcmp($l,$r);
@@ -44,6 +45,16 @@ while (@$D) {
push @other, sprintf "v.pm: %d", $vres;
}
}
+ if ($has_perl_versionpm) {
+ local $^W;
+ my $vpack = "Perl::Version"; # hide the name from 5.004
+ my $vres = eval { $vpack->new($l) cmp $vpack->new($r); };
+ if ($@) {
+ push @other, "PV: $@";
+ } elsif ($vres != $res) {
+ push @other, sprintf "PV: %d", $vres;
+ }
+ }
my $other = @other ? " (".join("; ", @other).")" : "";
printf "ok %2d # %12s %12s %3d%s\n", $N-@$D, $l, $r, $res, $other;
die "Panic" if CPAN::Version->vgt($l,$r) && CPAN::Version->vlt($l,$r);