This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
lib/locale.pm: Fix so works on platforms without LC_CTYPE
authorKarl Williamson <khw@cpan.org>
Fri, 20 Nov 2015 02:57:11 +0000 (19:57 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 20 Nov 2015 17:53:26 +0000 (10:53 -0700)
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

index fb91f0a..e2317ca 100644 (file)
@@ -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)) {