Skip Menu |

This queue is for tickets about the Number-Format CPAN distribution.

Report information
The Basics
Id: 97766
Status: new
Priority: 0/
Queue: Number-Format

People
Owner: Nobody in particular
Requestors: fraserbn [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] Handle perls built without locale support
..realistically though, this patch is just to get the module building and installing on Android :)
Subject: 0001-Handle-perls-built-without-locale-support.patch
From a090f771903f0ca58eef314cf0bf05dd8fa7387f Mon Sep 17 00:00:00 2001 From: Brian Fraser <fraserbn@gmail.com> Date: Tue, 5 Aug 2014 19:28:47 +0200 Subject: [PATCH] Handle perls built without locale support --- Format.pm | 2 +- t/format_negative.t | 5 ++++- t/format_number.t | 5 ++++- t/format_picture.t | 5 ++++- t/format_price.t | 5 ++++- t/locale.t | 3 +++ t/object.t | 6 ++++-- t/round.t | 5 ++++- t/unformat_number.t | 5 ++++- 9 files changed, 32 insertions(+), 9 deletions(-) diff --git a/Format.pm b/Format.pm index 4f736e0..c453585 100644 --- a/Format.pm +++ b/Format.pm @@ -409,7 +409,7 @@ sub new # Fetch defaults from current locale, or failing that, using globals my $me = {}; # my $locale = setlocale(LC_ALL, ""); - my $locale_values = localeconv(); + my $locale_values = eval { localeconv() }; my $arg; diff --git a/t/format_negative.t b/t/format_negative.t index b34a9d8..ddb3364 100644 --- a/t/format_negative.t +++ b/t/format_negative.t @@ -5,7 +5,10 @@ use strict; use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); +use Config; +if ( $Config{d_setlocale} ) { + setlocale(&LC_ALL, 'en_US'); +} BEGIN { use_ok('Number::Format') } diff --git a/t/format_number.t b/t/format_number.t index 6f905ea..5817ca6 100644 --- a/t/format_number.t +++ b/t/format_number.t @@ -5,7 +5,10 @@ use strict; use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); +use Config; +if ( $Config{d_setlocale} ) { + setlocale(&LC_ALL, 'en_US'); +} BEGIN { use_ok('Number::Format', ':subs') } diff --git a/t/format_picture.t b/t/format_picture.t index 782813d..b0f11f5 100644 --- a/t/format_picture.t +++ b/t/format_picture.t @@ -5,7 +5,10 @@ use strict; use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); +use Config; +if ( $Config{d_setlocale} ) { + setlocale(&LC_ALL, 'en_US'); +} BEGIN { use_ok('Number::Format') } diff --git a/t/format_price.t b/t/format_price.t index 5bf1ce9..5757dc6 100644 --- a/t/format_price.t +++ b/t/format_price.t @@ -5,7 +5,10 @@ use strict; use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); +use Config; +if ( $Config{d_setlocale} ) { + setlocale(&LC_ALL, 'en_US'); +} BEGIN { use_ok('Number::Format') } diff --git a/t/locale.t b/t/locale.t index 297b4d5..3cc41bf 100644 --- a/t/locale.t +++ b/t/locale.t @@ -3,6 +3,7 @@ use Test::More; use strict; use warnings; +use Config; BEGIN { # Do not test when under OpenBSD; see @@ -10,6 +11,8 @@ BEGIN { # http://undeadly.org/cgi?action=article&sid=20030206041352 plan skip_all => 'OpenBSD C library lacks locale support' if $^O =~ /^(openbsd|dragonfly)$/; + plan skip_all => 'Perl built without locale support' + unless $Config{d_setlocale}; plan 'no_plan'; } diff --git a/t/object.t b/t/object.t index ca485a3..6b94d39 100644 --- a/t/object.t +++ b/t/object.t @@ -5,8 +5,10 @@ use strict; use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); - +use Config; +if ( $Config{d_setlocale} ) { + setlocale(&LC_ALL, 'en_US'); +} BEGIN { use_ok('Number::Format') } my $deutsch = Number::Format->new(-thousands_sep => '.', diff --git a/t/round.t b/t/round.t index 8b2310e..0f295f8 100755 --- a/t/round.t +++ b/t/round.t @@ -5,7 +5,10 @@ use strict; use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); +use Config; +if ( $Config{d_setlocale} ) { + setlocale(&LC_ALL, 'en_US'); +} BEGIN { use_ok('Number::Format', ':subs') } diff --git a/t/unformat_number.t b/t/unformat_number.t index 63bd44b..284769e 100644 --- a/t/unformat_number.t +++ b/t/unformat_number.t @@ -4,8 +4,11 @@ use Test::More qw(no_plan); use strict; use warnings; +use Config; use POSIX; -setlocale(&LC_ALL, 'en_US'); +if ( $Config{d_setlocale} ) { + setlocale(&LC_ALL, 'en_US'); +} BEGIN { use_ok('Number::Format', ':subs') } -- 1.7.12.4 (Apple Git-37)