Subject: | t/locale.t fails on OpenBSD (as system lacks locale support) |
While installing this module (as an indirect dependency for
Task::Catalyst) under OpenBSD 4.6-current, I encountered failing tests
on t/locale.t, similar to bugs #46660, #46367, #45833, and #40859 in
this module's active bugs queue. I investigated this, and found that on
my particular system, setlocale(3) and friends are not yet complete, and
the system does not support changing the system locale via these
functions. See the following links:
- http://www.in-ulm.de/~mascheck/locale/ (describes OpenBSD's behavior)
- http://undeadly.org/cgi?action=article&sid=20030206041352 (attempts
to include locale support, as of 2003)
- setlocale(3) manual entry in OpenBSD says it only supports "C" and
"POSIX" locales for all but the LC_CTYPE locale
Included is a patch documenting this caveat, as well as skipping the
locale test under OpenBSD.
I have not tested this under the other BSDs, but I believe the situation
there could be the same.
Subject: | Number-Format-OpenBSD-nolocales.patch |
Index: Format.pm
===================================================================
RCS file: /cvsroot/number-format/perl/Number::Format/Format.pm,v
retrieving revision 1.53
diff -u -p -r1.53 Format.pm
--- Format.pm 5 May 2009 21:41:46 -0000 1.53
+++ Format.pm 6 Aug 2009 05:56:51 -0000
@@ -1192,6 +1192,12 @@ sub unformat_number
=back
+=head1 CAVEATS
+
+Some systems, notably OpenBSD, may have incomplete locale support.
+Using this module together with L<setlocale(3)> in OpenBSD may therefore
+not produce the intended results.
+
=head1 BUGS
No known bugs at this time. Report bugs using the CPAN request
Index: t/locale.t
===================================================================
RCS file: /cvsroot/number-format/perl/Number::Format/t/locale.t,v
retrieving revision 1.12
diff -u -p -r1.12 locale.t
--- t/locale.t 5 May 2009 21:45:07 -0000 1.12
+++ t/locale.t 6 Aug 2009 05:57:31 -0000
@@ -1,9 +1,18 @@
# -*- CPerl -*-
-use Test::More qw(no_plan);
+use Test::More;
use strict;
use warnings;
+BEGIN {
+ # Do not test when under OpenBSD; see
+ # http://www.in-ulm.de/~mascheck/locale/ and
+ # http://undeadly.org/cgi?action=article&sid=20030206041352
+ plan skip_all => 'OpenBSD C library lacks locale support'
+ if $^O eq 'openbsd';
+ plan 'no_plan';
+}
+
BEGIN { use_ok('Number::Format') }
BEGIN { use_ok('POSIX') }