Subject: | Sharing *version:: into Safe compartment breaks version::vpp overloads |
When *version:: is shared into the Safe compartment, all overloads inside it are removed by Safe.pm. Afterward, Parse::PMFile restores the overloads on version, but not version::vpp. This breaks ->VERSION checks, as version::vpp internally uses version::vpp->new in its comparisons.
Attached is a patch to add testing for this. To reproduce, use perl 5.18.2 and install the latest version.pm.
Subject: | overload-test.patch |
diff --git i/t/80_version_overload.t w/t/80_version_overload.t
index fc60a3d..8b4e411 100644
--- i/t/80_version_overload.t
+++ w/t/80_version_overload.t
@@ -3,6 +3,7 @@ use warnings;
use Test::More;
use FindBin;
use Parse::PMFile;
+use version::vpp;
for my $fork (0..1) {
test_version($fork);
@@ -29,4 +30,10 @@ sub test_version {
ok $v1 lt $v2, "FORK $fork: 0.02 should be greater than 0.01";
ok (($v1 ? 1 : 0), "FORK $fork: bool");
note "v1: $v1 v2: $v2";
+ my $v3 = version::vpp->parse('0.03');
+ my $v4 = version::vpp->parse('0.04');
+ ok $v3 < $v4, "FORK $fork: 0.04 should be greater than 0.03";
+ ok $v3 lt $v4, "FORK $fork: 0.04 should be greater than 0.03";
+ ok (($v3 ? 1 : 0), "FORK $fork: bool");
+ note "v3: $v3 v4: $v4";
}