From 467a667a478081da892b51bc98585434c22c3069 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Thu, 19 Nov 2015 19:57:11 -0700 Subject: [PATCH] lib/locale.pm: Fix so works on platforms without LC_CTYPE These may not actually exist in the wild, but it is better to be general. This also adds an XXX comment about future possibilities. --- lib/locale.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/locale.pm b/lib/locale.pm index fb91f0a..e2317ca 100644 --- a/lib/locale.pm +++ b/lib/locale.pm @@ -1,6 +1,6 @@ package locale; -our $VERSION = '1.07'; +our $VERSION = '1.08'; use Config; $Carp::Internal{ (__PACKAGE__) } = 1; @@ -97,15 +97,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 my $LC = "LC_" . uc($arg); my $bit = eval "&POSIX::$LC"; - if (defined $bit) { + if (defined $bit) { # XXX Should we warn that this category isn't + # supported on this platform, or make it + # always be the C locale? # Verify our assumption. if (! ($bit >= 0 && $bit < 31)) { -- 1.8.3.1