Subject: | [PATCH] Handle systems without setlocale() |
Some systems (Android, WinCE) are bundled with little or no locale support. In Android, for example, setlocale() just thows an unimplemented warning, as does LC_ALL.
So in those systems, just wrap the calls to setlocale() in an eval {}, which sidesteps the issue and makes the module install cleanly.
Subject: | 0001-Handle-systems-without-setlocale.patch |
From 396a5ea9b0041c4dcfd89668cbef0b9777f1531f Mon Sep 17 00:00:00 2001
From: Brian Fraser <fraserbn@gmail.com>
Date: Fri, 1 Aug 2014 00:57:15 +0200
Subject: [PATCH] Handle systems without setlocale()
---
lib/Lingua/EN/Sentence.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/Lingua/EN/Sentence.pm b/lib/Lingua/EN/Sentence.pm
index 62213ec..6234c04 100644
--- a/lib/Lingua/EN/Sentence.pm
+++ b/lib/Lingua/EN/Sentence.pm
@@ -145,7 +145,7 @@ use Carp qw/cluck/;
$VERSION = '0.25';
# LC_CTYPE now in locale "French, Canada, codeset ISO 8859-1"
-$LOC=setlocale(LC_CTYPE, "fr_CA.ISO8859-1");
+$LOC=eval { setlocale(LC_CTYPE, "fr_CA.ISO8859-1") };
use locale;
@ISA = qw( Exporter );
@@ -279,7 +279,7 @@ sub set_locale {
cluck "Won't set locale to undefined value!\n";
return undef;
}
- $LOC = setlocale(LC_CTYPE, $new_locale);
+ $LOC = eval { setlocale(LC_CTYPE, $new_locale) };
return $LOC;
}
--
1.7.12.4 (Apple Git-37)