diff options
author | Florian Ragwitz <rafl@debian.org> | 2010-12-10 13:50:00 +0100 |
---|---|---|
committer | Florian Ragwitz <rafl@debian.org> | 2010-12-10 13:52:42 +0100 |
commit | e9c8e76089e57d605c17550161ab47509161a07d (patch) | |
tree | 1c4fe03f17eee3e295973b82ef9aae45f6223966 | |
parent | b8677e3b6a8c160eef39f06730392d031a846b22 (diff) | |
download | perl-e9c8e76089e57d605c17550161ab47509161a07d.tar.gz |
Dual-life I18N::Collate
-rw-r--r-- | MANIFEST | 4 | ||||
-rwxr-xr-x | Porting/Maintainers.pl | 9 | ||||
-rw-r--r-- | dist/I18N-Collate/lib/I18N/Collate.pm (renamed from lib/I18N/Collate.pm) | 16 | ||||
-rw-r--r-- | dist/I18N-Collate/t/I18N-Collate.t (renamed from lib/I18N/Collate.t) | 8 | ||||
-rw-r--r-- | lib/.gitignore | 1 |
5 files changed, 24 insertions, 14 deletions
@@ -2748,6 +2748,8 @@ dist/Filter-Simple/t/lib/Filter/Simple/ExportTest.pm Helper file for Filter::Si dist/Filter-Simple/t/lib/Filter/Simple/FilterOnlyTest.pm Helper file for Filter::Simple tests dist/Filter-Simple/t/lib/Filter/Simple/FilterTest.pm Helper file for Filter::Simple tests dist/Filter-Simple/t/lib/Filter/Simple/ImportTest.pm Helper file for Filter::Simple tests +dist/I18N-Collate/lib/I18N/Collate.pm Routines to do strxfrm-based collation +dist/I18N-Collate/t/I18N-Collate.t See if I18N::Collate works dist/I18N-LangTags/ChangeLog I18N::LangTags dist/I18N-LangTags/lib/I18N/LangTags/Detect.pm Detect language preferences dist/I18N-LangTags/lib/I18N/LangTags/List.pm List of tags for human languages @@ -3727,8 +3729,6 @@ lib/Getopt/Std.t See if Getopt::Std and Getopt::Long work lib/h2ph.t See if h2ph works like it should lib/h2xs.t See if h2xs produces expected lists of files lib/hostname.pl Old hostname code -lib/I18N/Collate.pm Routines to do strxfrm-based collation -lib/I18N/Collate.t See if I18N::Collate works lib/importenv.pl Perl routine to get environment into variables lib/integer.pm For "use integer" lib/integer.t For "use integer" testing diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 33d0607c02..3228cc4fb5 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -721,6 +721,14 @@ use File::Glob qw(:case); 'UPSTREAM' => 'cpan', }, + 'I18N::Collate' => + { + 'MAINTAINER' => 'p5p', + 'DISTRIBUTION' => 'FLORA/I18N-Collate-1.01.tar.gz', + 'FILES' => q[dist/I18N-Collate], + 'UPSTREAM' => 'blead', + }, + # Sean has donated it to us. # Nothing has changed since his last CPAN release. # (not strictly true: there have been some trivial typo fixes; DAPM 6/2009) @@ -1712,7 +1720,6 @@ use File::Glob qw(:case); lib/FileHandle.{pm,t} lib/FindBin.{pm,t} lib/Getopt/Std.{pm,t} - lib/I18N/Collate.{pm,t} lib/Internals.t lib/Module/Build/ConfigData.pm lib/Net/hostent.{pm,t} diff --git a/lib/I18N/Collate.pm b/dist/I18N-Collate/lib/I18N/Collate.pm index decc86ce3f..95c9c1c35c 100644 --- a/lib/I18N/Collate.pm +++ b/dist/I18N-Collate/lib/I18N/Collate.pm @@ -10,7 +10,7 @@ I18N::Collate - compare 8-bit scalar data according to the current locale =head1 SYNOPSIS use I18N::Collate; - setlocale(LC_COLLATE, 'locale-of-your-choice'); + setlocale(LC_COLLATE, 'locale-of-your-choice'); $s1 = I18N::Collate->new("scalar_data_1"); $s2 = I18N::Collate->new("scalar_data_2"); @@ -33,8 +33,8 @@ I18N::Collate - compare 8-bit scalar data according to the current locale *** -This module provides you with objects that will collate -according to your national character set, provided that the +This module provides you with objects that will collate +according to your national character set, provided that the POSIX setlocale() function is supported on your system. You can compare $s1 and $s2 above with @@ -83,11 +83,11 @@ European character set. # setlocale(LC_COLLATE, 'locale-of-your-choice'); # 4) # $s1 = I18N::Collate->("scalar_data_1"); # $s2 = I18N::Collate->("scalar_data_2"); -# +# # now you can compare $s1 and $s2: $s1 le $s2 # to extract the data itself, you need to deref: $$s1 -# -# Notes: +# +# Notes: # 1) this uses POSIX::setlocale # 2) the basic collation conversion is done by strxfrm() which # terminates at NUL characters being a decent C routine. @@ -161,7 +161,7 @@ sub setlocale { my ($category, $locale) = @_[0,1]; POSIX::setlocale($category, $locale) if (defined $category); - # the current $LOCALE + # the current $LOCALE $LOCALE = $locale || $ENV{'LC_COLLATE'} || $ENV{'LC_ALL'} || ''; } @@ -177,7 +177,7 @@ sub C { sub collate_xfrm { my $s = $_[0]; my $x = ''; - + for (split(/(\000+)/, $s)) { $x .= (/^\000/) ? $_ : strxfrm("$_\000"); } diff --git a/lib/I18N/Collate.t b/dist/I18N-Collate/t/I18N-Collate.t index bf3ba20b6a..17280266e9 100644 --- a/lib/I18N/Collate.t +++ b/dist/I18N-Collate/t/I18N-Collate.t @@ -1,8 +1,11 @@ #!./perl +# at least in the CPAN version we're sometimes called with -w, for example +# during 'make test', so disable them explicitly and only turn them on again for +# the deprecation test. +no warnings; + BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; require Config; import Config; if (!$Config{d_setlocale} || $Config{ccflags} =~ /\bD?NO_LOCALE\b/) { print "1..0\n"; @@ -41,4 +44,3 @@ print "ok 6\n"; print "not " if $a lt $b == $a gt $b; print "ok 7\n"; - diff --git a/lib/.gitignore b/lib/.gitignore index e35ae28515..7f45114bf5 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -183,6 +183,7 @@ /Filter/Util /GDBM_File.pm /Hash +/I18N/Collate.pm /I18N/LangTags /I18N/LangTags.pm /I18N/Langinfo.pm |