This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/loc_tools.pl: miniperl can't use locale handling
authorKarl Williamson <khw@cpan.org>
Sat, 13 Apr 2019 18:01:40 +0000 (12:01 -0600)
committerKarl Williamson <khw@cpan.org>
Sat, 13 Apr 2019 18:16:11 +0000 (12:16 -0600)
Assume there is no locale handling on this system in the function
locales_enabled() if we are operating (as in minitest) without the boot
loader, as they can't be accessed because the POSIX module which
contains setlocale() can't be loaded.

t/loc_tools.pl

index 01426c8..2d35c59 100644 (file)
@@ -210,6 +210,10 @@ sub locales_enabled(;$) {
     # khw cargo-culted the '?' in the pattern on the next line.
     return 0 if $Config{ccflags} =~ /\bD?NO_LOCALE\b/;
 
+    # If we can't load the POSIX XS module, we can't have locales even if they
+    # normally would be available
+    return 0 if ! defined &DynaLoader::boot_DynaLoader;
+
     if (! $Config{d_setlocale}) {
         return 0 if $Config{ccflags} =~ /\bD?NO_POSIX_2008_LOCALE\b/;
         return 0 unless $Config{d_newlocale};