From 395e49858e6cabdc5c8ecc0647e256452bd20f64 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Tue, 10 Jun 2014 20:18:50 -0400 Subject: Locale tests assumed POSIX, not true in minitest. --- lib/locale.pm | 7 ++++++- t/loc_tools.pl | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/locale.pm b/lib/locale.pm index 52279a1693..886fb3b491 100644 --- a/lib/locale.pm +++ b/lib/locale.pm @@ -96,9 +96,14 @@ sub import { $arg =~ s/^://; + eval { require POSIX; import POSIX 'locale_h'; }; + unless (defined &POSIX::LC_CTYPE) { + return; + } + # Map our names to the ones defined by POSIX $arg = "LC_" . uc($arg); - use POSIX 'locale_h'; + my $bit = eval "&POSIX::$arg"; if (defined $bit) { # 1 is added so that the pseudo-category :characters, which is diff --git a/t/loc_tools.pl b/t/loc_tools.pl index 90865e4702..bac8cc7f1a 100644 --- a/t/loc_tools.pl +++ b/t/loc_tools.pl @@ -90,7 +90,10 @@ sub find_locales ($) { # Returns an array of all the locales we found on the # Done this way in case this is 'required' in the caller before seeing if # this is miniperl. - require POSIX; import POSIX 'locale_h'; + eval { require POSIX; import POSIX 'locale_h'; }; + unless (defined &POSIX::LC_CTYPE) { + return; + } _trylocale("C", $categories, \@Locale); _trylocale("POSIX", $categories, \@Locale); -- cgit v1.2.1