From 49efabc8040649cbf0c684a68cbf2a0c0e4aa7b6 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 7 Jul 2014 15:14:49 -0600 Subject: POSIX::setlocale(LC_NUMERIC) returns proper locale Commit 4c28b29c7a1549f173177cdf69e91cc1acaa0969 broke calling setlocale with a single parameter and hoping to get the correct LC_NUMERIC property returned from it (including LC_ALL calls). This is because the numeric locale is now kept as C except around the code that wants it to be the underlying locale. It turns out that querying the current locale is such a code area, so LC_NUMERIC is now set to the underlying locale around this. --- t/run/locale.t | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 't/run') diff --git a/t/run/locale.t b/t/run/locale.t index ef88ea61de..7af7875f8c 100644 --- a/t/run/locale.t +++ b/t/run/locale.t @@ -25,6 +25,16 @@ my @locales = eval { find_locales( [ &LC_ALL, &LC_CTYPE, &LC_NUMERIC ] ) }; skip_all("no locales available") unless @locales; plan tests => &last; + +foreach my $locale (@locales) { + next if $locale eq "C"; + setlocale(LC_NUMERIC, $locale) or next; + isnt(setlocale(LC_NUMERIC), "C", "retrieving current non-C LC_ALL doesn't give 'C'"); + setlocale(LC_ALL, $locale) or next; + isnt(setlocale(LC_ALL), "C", "retrieving current non-C LC_ALL doesn't give 'C'"); + last; +} + fresh_perl_is("for (qw(@locales)) {\n" . <<'EOF', use POSIX qw(locale_h); use locale; @@ -408,4 +418,4 @@ EOF } -sub last { 35 } +sub last { 37 } -- cgit v1.2.1