[interchange] Fix regression with how Vend::Safe performs initialization
David Christensen <[email protected]> Mon, 02 May 2016 20:40:00 +0000
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 672b8a113a515671967a04b2754323c7f643dbce Author: David Christensen <[email protected]> Date: Mon May 2 15:39:03 2016 -0500 Fix regression with how Vend::Safe performs initialization 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. lib/Vend/Safe.pm | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) --- diff --git a/lib/Vend/Safe.pm b/lib/Vend/Safe.pm index 19a9620..cc2e6a2 100644 --- a/lib/Vend/Safe.pm +++ b/lib/Vend/Safe.pm @@ -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. @@ -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; }