From 2d6317a513993d9e2c0557bd11b18f44820ca63d Mon Sep 17 00:00:00 2001 From: Erik Huelsmann Date: Sun, 22 Oct 2023 10:28:40 +0200 Subject: [PATCH 1/3] Specify minimum version for Locale::CLDR::Locales::* dependencies --- cpanfile | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/cpanfile b/cpanfile index a15a828f8d..b0b8013277 100644 --- a/cpanfile +++ b/cpanfile @@ -39,33 +39,33 @@ requires 'JSONSchema::Validator'; requires 'List::MoreUtils'; requires 'Locale::CLDR'; # Keep thoss in sync with the languages defined in Pg-database.sql -requires 'Locale::CLDR::Locales::Ar'; -requires 'Locale::CLDR::Locales::Bg'; -requires 'Locale::CLDR::Locales::Ca'; -requires 'Locale::CLDR::Locales::Cs'; -requires 'Locale::CLDR::Locales::Da'; -requires 'Locale::CLDR::Locales::De'; -requires 'Locale::CLDR::Locales::El'; -requires 'Locale::CLDR::Locales::En'; -requires 'Locale::CLDR::Locales::Es'; -requires 'Locale::CLDR::Locales::Et'; -requires 'Locale::CLDR::Locales::Fi'; -requires 'Locale::CLDR::Locales::Fr'; -requires 'Locale::CLDR::Locales::Hu'; -requires 'Locale::CLDR::Locales::Id'; -requires 'Locale::CLDR::Locales::Is'; -requires 'Locale::CLDR::Locales::It'; -requires 'Locale::CLDR::Locales::Lt'; -requires 'Locale::CLDR::Locales::Ms'; -requires 'Locale::CLDR::Locales::Nb'; -requires 'Locale::CLDR::Locales::Nl'; -requires 'Locale::CLDR::Locales::Pl'; -requires 'Locale::CLDR::Locales::Pt'; -requires 'Locale::CLDR::Locales::Ru'; -requires 'Locale::CLDR::Locales::Sv'; -requires 'Locale::CLDR::Locales::Tr'; -requires 'Locale::CLDR::Locales::Uk'; -requires 'Locale::CLDR::Locales::Zh'; +requires 'Locale::CLDR::Locales::Ar', '0.34.2'; +requires 'Locale::CLDR::Locales::Bg', '0.34.2'; +requires 'Locale::CLDR::Locales::Ca', '0.34.2'; +requires 'Locale::CLDR::Locales::Cs', '0.34.2'; +requires 'Locale::CLDR::Locales::Da', '0.34.2'; +requires 'Locale::CLDR::Locales::De', '0.34.2'; +requires 'Locale::CLDR::Locales::El', '0.34.2'; +requires 'Locale::CLDR::Locales::En', '0.34.2'; +requires 'Locale::CLDR::Locales::Es', '0.34.2'; +requires 'Locale::CLDR::Locales::Et', '0.34.2'; +requires 'Locale::CLDR::Locales::Fi', '0.34.2'; +requires 'Locale::CLDR::Locales::Fr', '0.34.2'; +requires 'Locale::CLDR::Locales::Hu', '0.34.2'; +requires 'Locale::CLDR::Locales::Id', '0.34.2'; +requires 'Locale::CLDR::Locales::Is', '0.34.2'; +requires 'Locale::CLDR::Locales::It', '0.34.2'; +requires 'Locale::CLDR::Locales::Lt', '0.34.2'; +requires 'Locale::CLDR::Locales::Ms', '0.34.2'; +requires 'Locale::CLDR::Locales::Nb', '0.34.2'; +requires 'Locale::CLDR::Locales::Nl', '0.34.2'; +requires 'Locale::CLDR::Locales::Pl', '0.34.2'; +requires 'Locale::CLDR::Locales::Pt', '0.34.2'; +requires 'Locale::CLDR::Locales::Ru', '0.34.2'; +requires 'Locale::CLDR::Locales::Sv', '0.34.2'; +requires 'Locale::CLDR::Locales::Tr', '0.34.2'; +requires 'Locale::CLDR::Locales::Uk', '0.34.2'; +requires 'Locale::CLDR::Locales::Zh', '0.34.2'; requires 'Locale::Maketext::Lexicon', '0.62'; requires 'Locales'; requires 'Log::Any'; From b71a1cbd328737fe0d87e6fdd6ba6e024a0e40b2 Mon Sep 17 00:00:00 2001 From: Erik Huelsmann Date: Sun, 22 Oct 2023 10:28:57 +0200 Subject: [PATCH 2/3] Revert "Work around Locale::CLDR::Locales::* loading 'bignum'" This reverts commit ed43b77ba9219bd7f6bdd96c78d0dfc88a33ddf5. Starting 0.34.2, Locale::CLDR stopped loading bignum, using bigfloat instead. --- lib/LedgerSMB.pm | 4 ---- lib/LedgerSMB/Database/Config.pm | 10 ++-------- lib/LedgerSMB/I18N.pm | 8 +------- lib/LedgerSMB/Scripts/user.pm | 8 +------- 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/lib/LedgerSMB.pm b/lib/LedgerSMB.pm index fe3fcf9321..4f660d1fe7 100644 --- a/lib/LedgerSMB.pm +++ b/lib/LedgerSMB.pm @@ -233,8 +233,6 @@ use List::Util qw( pairgrep ); use Locale::CLDR; use Locales unicode => 1; use Log::Any; -use Math::BigFloat; -use Math::BigInt; use PGObject; use Plack; use URI; @@ -627,8 +625,6 @@ sub enabled_languages { sub enabled_countries { my ($self) = @_; - local $Math::BigInt::upgrade = undef; - local $Math::BigFloat::downgrade = undef; my $regions = Locale::CLDR->new($self->{_user}->{language})->all_regions; return [ map { diff --git a/lib/LedgerSMB/Database/Config.pm b/lib/LedgerSMB/Database/Config.pm index 479c26698d..1643b749c2 100644 --- a/lib/LedgerSMB/Database/Config.pm +++ b/lib/LedgerSMB/Database/Config.pm @@ -19,8 +19,6 @@ use namespace::autoclean; use File::Find::Rule; use File::Spec; use Locale::CLDR; -use Math::BigFloat; -use Math::BigInt; =head1 SYNOPSIS @@ -127,12 +125,8 @@ sub charts_of_accounts { ###TODO: Define a parameter to the SQL directory!! my $basedir = File::Spec->catfile('.', 'locale', 'coa'); my $countries = _list_directory($basedir); - my $cldr = do { - local $Math::BigInt::upgrade = undef; - local $Math::BigFloat::downgrade = undef; - Locale::CLDR->new($self->language); - }; - my %regions = %{$cldr->all_regions}; + my %regions = %{Locale::CLDR->new($self->language) + ->all_regions}; return { map { diff --git a/lib/LedgerSMB/I18N.pm b/lib/LedgerSMB/I18N.pm index 84f1305a68..54869a8e9d 100644 --- a/lib/LedgerSMB/I18N.pm +++ b/lib/LedgerSMB/I18N.pm @@ -21,8 +21,6 @@ we look only to the current locale. use Locale::CLDR; use Locales unicode => 1; -use Math::BigFloat; -use Math::BigInt; use Moose::Role; use namespace::autoclean; use LedgerSMB::App_State; @@ -129,11 +127,7 @@ Get a country localized list to allow user selection sub get_country_list { my $language = shift; - my %regions = do { - local $Math::BigInt::upgrade = undef; - local $Math::BigFloat::downgrade = undef; - Locale::CLDR->new($language)->all_regions->%* - }; + my %regions = Locale::CLDR->new($language)->all_regions->%*; return [ sort { $a->{text} cmp $b->{text} } map { +{ value => uc($_), diff --git a/lib/LedgerSMB/Scripts/user.pm b/lib/LedgerSMB/Scripts/user.pm index 54af4d0659..dc7b80c1bf 100644 --- a/lib/LedgerSMB/Scripts/user.pm +++ b/lib/LedgerSMB/Scripts/user.pm @@ -30,8 +30,6 @@ use feature 'fc'; use DateTime::Format::Duration::ISO8601; use Locale::CLDR; -use Math::BigFloat; -use Math::BigInt; use LedgerSMB::Locale; use LedgerSMB::User; @@ -134,11 +132,7 @@ sub preference_screen { dateformats => $dateformats, language_codes => _language_options( $request, - do { - local $Math::BigInt::upgrade = undef; - local $Math::BigFloat::downgrade = undef; - Locale::CLDR->new( $prefs->{language} ); - }), + Locale::CLDR->new( $prefs->{language} )), login => $login, numberformats => $numberformats, password_expires => { From 328518f040cf349ed55b5640c21e652992386ff4 Mon Sep 17 00:00:00 2001 From: Erik Huelsmann Date: Sun, 22 Oct 2023 17:17:56 +0200 Subject: [PATCH 3/3] Add Locale::CLDR minimum version --- cpanfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpanfile b/cpanfile index b0b8013277..295c8c657c 100644 --- a/cpanfile +++ b/cpanfile @@ -37,7 +37,7 @@ recommends 'Cpanel::JSON::XS', '3.0206'; # 3.0206 adds 'allow_bignum' option recommends 'JSON::PP', '2.00'; # 1.99_01 adds 'allow_bignum' requires 'JSONSchema::Validator'; requires 'List::MoreUtils'; -requires 'Locale::CLDR'; +requires 'Locale::CLDR', '0.34.2'; # Keep thoss in sync with the languages defined in Pg-database.sql requires 'Locale::CLDR::Locales::Ar', '0.34.2'; requires 'Locale::CLDR::Locales::Bg', '0.34.2';