$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
# 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);