In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/cf34c81f6b96c70e2ecf357bbaf3b28eb58272c4?hp=c83a69a2acd789c69782efea29f4d01680afee33>
- Log ----------------------------------------------------------------- commit cf34c81f6b96c70e2ecf357bbaf3b28eb58272c4 Author: Karl Williamson <[email protected]> Date: Sat Nov 15 09:51:28 2014 -0700 t/loc_tools.pl: try code page 1252 locales This makes sure this common locale on Windows doesn't get overlooked. M t/loc_tools.pl commit c1d1e689babab16d1b952c656097740ae23cb861 Author: Karl Williamson <[email protected]> Date: Sat Nov 15 09:50:51 2014 -0700 t/loc_tools.pl: Nits in comments, white-space only M t/loc_tools.pl commit 6475ad77628d7565995310eb58147eb2ab4924ad Author: Karl Williamson <[email protected]> Date: Sat Nov 15 09:48:14 2014 -0700 Silence spurious locale warnings When testing the locales on the system, we don't want to be warned that particular ones may not work well with Perl, as the point of the test is to find and list the incompatibilities. When looking for locales suitable for some purpose, we try every one possible until we find one that matches what we're looking for. This may entail briefly switching into locales that aren't fully compatible with Perl. Again we don't want to be warned about such a locale. We're not using it for anything except to determine suitability anyway. M lib/locale.t M t/loc_tools.pl ----------------------------------------------------------------------- Summary of changes: lib/locale.t | 2 ++ t/loc_tools.pl | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/locale.t b/lib/locale.t index 2845f13..8a3d44b 100644 --- a/lib/locale.t +++ b/lib/locale.t @@ -710,6 +710,8 @@ debug "Scanning for locales...\n"; require POSIX; import POSIX ':locale_h'; +no warnings 'locale'; # We test even weird locales; + my @Locale = find_locales([ &POSIX::LC_CTYPE, &POSIX::LC_NUMERIC, &POSIX::LC_ALL ]); debug "Locales =\n"; diff --git a/t/loc_tools.pl b/t/loc_tools.pl index 5406368..b4845b8 100644 --- a/t/loc_tools.pl +++ b/t/loc_tools.pl @@ -8,6 +8,11 @@ # anyway later during the scanning process (and besides, some clueless # vendor might have them capitalized erroneously anyway). +# Some of the locales on the system may not play well with Perl. Since, we +# may be trying every possible locale, we don't want to be warned about the +# weird ones. +no warnings 'locale'; + sub _trylocale { # Adds the locale given by the first parameter to the list # given by the 3rd iff the platform supports the locale in # each of the categories given by the 2nd parameter, which @@ -53,6 +58,7 @@ sub _decode_encodings { push @enc, "$_.65001"; # Windows UTF-8 push @enc, "$_.ACP"; # Windows ANSI code page push @enc, "$_.OCP"; # Windows OEM code page + push @enc, "$_.1252"; # Windows } } if ($^O eq 'os390') { @@ -68,7 +74,9 @@ sub find_locales ($) { # Returns an array of all the locales we found on the # system. The parameter is either a single locale # category or a reference to a list of categories to # find valid locales for it (or in the case of - # multiple) for all of them + # multiple) for all of them. Note that currently the + # array includes even those locales that don't play + # well with Perl my $categories = shift; use Config;; @@ -156,7 +164,6 @@ sub find_locales ($) { # Returns an array of all the locales we found on the # This is going to be slow. my @Data; - # Locales whose name differs if the utf8 bit is on are stored in these two # files with appropriate encodings. if ($^H & 0x08 || (${^OPEN} || "") =~ /:utf8/) { @@ -203,8 +210,6 @@ sub find_locales ($) { # Returns an array of all the locales we found on the @Locale = sort @Locale; return @Locale; - - } sub is_locale_utf8 ($) { # Return a boolean as to if core Perl thinks the input @@ -250,7 +255,7 @@ sub is_locale_utf8 ($) { # Return a boolean as to if core Perl thinks the input return $ret; } -sub find_utf8_ctype_locale (;$) { # Return the name of locale that core Perl +sub find_utf8_ctype_locale (;$) { # Return the name of a locale that core Perl # thinks is a UTF-8 LC_CTYPE locale. # Optional parameter is a reference to a # list of locales to try; if omitted, this -- Perl5 Master Repository
