Skip to content

Commit

Permalink
Fix regression with how Vend::Safe performs initialization
Browse files Browse the repository at this point in the history
In newer versions of Perl (5.18+) `make test` failed due to some odd interactions with Safe and Unicode
initialization.  The good news is that the failing routines are no longer needed, because Safe.pm now
properly sets up Safe compartments with Unicode support without needing our help.

Avoid the special-case handling by Interchange when we are using a new enough Safe.pm.
  • Loading branch information
David Christensen committed May 2, 2016
1 parent 7719042 commit 672b8a1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/Vend/Safe.pm
Expand Up @@ -27,6 +27,12 @@ use warnings;
use Vend::CharSet;
use Safe;

BEGIN {
eval {
require version;
};
};

# The L<new> method creates and returns an initialized Safe
# compartment. This is mainly provided so there is a single point of
# modification for all needed Safe.pm initializations.
Expand All @@ -35,7 +41,11 @@ sub new {
my ($invocant, @args) = @_;

my $safe = Safe->new(@args);
$invocant->initialize_safe_compartment($safe);

# Safe started taking better care of Unicode things as of version 2.32
if ($] lt '5.009' || version->parse($Safe::VERSION) < version->parse('2.32')) {
$invocant->initialize_safe_compartment($safe);
}

return $safe;
}
Expand Down

1 comment on commit 672b8a1

@hexfusion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 nice work @machack666

Please sign in to comment.