This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
D:P: PATCH: gh #156 sync_locale doesn't work in 5.20 maint
authorKarl Williamson <khw@cpan.org>
Wed, 13 Nov 2019 16:15:17 +0000 (09:15 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 22 Nov 2019 13:49:04 +0000 (06:49 -0700)
It turns out that there was special code added in the 5.20 maint series
that needed to be accounted for.

dist/Devel-PPPort/parts/inc/locale

index f8ad196..699adfd 100644 (file)
@@ -17,10 +17,15 @@ __UNDEFINED__  switch_to_global_locale()
 #    if { VERSION >= 5.21.3 }
 #      undef sync_locale
 #      define sync_locale() (Perl_sync_locale(aTHX), 1)
+#    elif defined(sync_locale)  /* These should be the 5.20 maints*/
+#      undef sync_locale        /* Just copy their defn and return 1 */
+#      define sync_locale() (new_ctype(setlocale(LC_CTYPE, NULL)),        \
+                             new_collate(setlocale(LC_COLLATE, NULL)),    \
+                             set_numeric_local(),                         \
+                             new_numeric(setlocale(LC_NUMERIC, NULL)),    \
+                             1)
 #    elif defined(new_ctype) && defined(LC_CTYPE)
 #      define sync_locale() (new_ctype(setlocale(LC_CTYPE, NULL)), 1)
-#    else
-#      undef sync_locale
 #    endif
 #  endif
 #endif