Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to work with perls since 5.37.7 #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions Format.pm
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,13 @@ our $DEFAULT_LOCALE = { (
) };

#
# On Windows, the POSIX localeconv() call returns illegal negative
# numbers for some values, seemingly attempting to indicate null. The
# following list indicates the values for which this has been
# observed, and for which the values should be stripped out of
# localeconv().
# POSIX::localeconv() returns -1 for numeric values that are not applicable to
# the current locale. This module ignores them. @IGNORE_NEGATIVE lists the
# ones that this module otherwise handles (there are some fields that this
# module always ignores, so don't need to be in the list). (Prior to v5.37.7,
# only the Windows version of POSIX::localeconv() returned -1; other versions
# simply didn't return any values at all for not-applicable fields. But the
# end result is the same regardless of version.)
#
our @IGNORE_NEGATIVE = qw( frac_digits int_frac_digits
n_cs_precedes n_sep_by_space n_sign_posn
Expand Down Expand Up @@ -379,7 +381,11 @@ sub _check_seps
croak("${prefix}thousands_sep and ".
"${prefix}decimal_point may not be equal")
if $self->{"${prefix}decimal_point"} eq
$self->{"${prefix}thousands_sep"};
$self->{"${prefix}thousands_sep"}

# There are legal locales where 'mon_decimal_point' and
# 'mon_thousands_sep' are both "" (the empty string)
&& ($prefix eq "" || $self->{"mon_decimal_point"} ne "");
}
}

Expand Down Expand Up @@ -475,9 +481,11 @@ sub new

while(my($arg, $default) = each %$DEFAULT_LOCALE)
{
$me->{$arg} = (exists $locale_values->{$arg}
$me->{$arg} = (( exists $locale_values->{$arg})
&& $locale_values->{$arg} ne "")
? $locale_values->{$arg}
: $default);
: $default;


foreach ($arg, uc $arg, "-$arg", uc "-$arg")
{
Expand All @@ -489,10 +497,10 @@ sub new
}

#
# Some broken locales define the decimal_point but not the
# thousands_sep. If decimal_point is set to "," the default
# thousands_sep will be a conflict. In that case, set
# thousands_sep to empty string. Suggested by Moritz Onken.
# Some locales set the decimal_point to "," and the thousands_sep to "".
# This module generally defaults an empty thousands_sep to ",", creating a
# conflict in such a locale. Instead, leave the thousands_sep as the
# empty string. Suggested by Moritz Onken.
#
foreach my $prefix ("", "mon_")
{
Expand Down