From ae6aa56258ddae4c1d0bf3bf7356f260a4cd9744 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Tue, 10 Jun 2003 05:14:18 +0000 Subject: [PATCH] Upgrade to Unicode::Collate 0.25. p4raw-id: //depot/perl@19734 --- lib/Unicode/Collate.pm | 39 ++++++++++----------------------------- lib/Unicode/Collate/Changes | 6 +++++- lib/Unicode/Collate/README | 4 ++-- lib/Unicode/Collate/t/index.t | 2 +- lib/Unicode/Collate/t/test.t | 2 +- 5 files changed, 19 insertions(+), 34 deletions(-) diff --git a/lib/Unicode/Collate.pm b/lib/Unicode/Collate.pm index a753808..4be5aab 100644 --- a/lib/Unicode/Collate.pm +++ b/lib/Unicode/Collate.pm @@ -1,7 +1,7 @@ package Unicode::Collate; BEGIN { - unless ("A" eq pack('U', 0x41) || "A" eq pack('U', ord("A"))) { + unless ("A" eq pack('U', 0x41)) { die "Unicode::Collate cannot stringify a Unicode code point\n"; } } @@ -14,7 +14,7 @@ use File::Spec; require Exporter; -our $VERSION = '0.24'; +our $VERSION = '0.25'; our $PACKAGE = __PACKAGE__; our @ISA = qw(Exporter); @@ -111,27 +111,12 @@ sub Base_Unicode_Version { $UNICODE_VERSION || 'unknown' } ###### -use constant UNICODE_FOR_PACK => ("A" eq pack('U', 0x41)); -use constant NATIVE_FOR_PACK => ("A" eq pack('U', ord("A"))); - -use constant UNICODE_FOR_UNPACK => (0x41 == unpack('U', "A")); -use constant NATIVE_FOR_UNPACK => (ord("A") == unpack('U', "A")); - sub pack_U { - return UNICODE_FOR_PACK - ? pack('U*', @_) - : NATIVE_FOR_PACK - ? pack('U*', map utf8::unicode_to_native($_), @_) - : die "$PACKAGE, a Unicode code point cannot be stringified.\n"; + return pack('U*', @_); } sub unpack_U { - return UNICODE_FOR_UNPACK - ? unpack('U*', shift) - : NATIVE_FOR_UNPACK - ? map(utf8::native_to_unicode($_), unpack 'U*', shift) - : die "$PACKAGE, a code point returned from unpack U " . - "cannot be converted into Unicode.\n"; + return unpack('U*', pack('U*').shift); } ###### @@ -1206,9 +1191,12 @@ but it is not warned at present.> -- see 3.2 Default Unicode Collation Element Table, UTS #10. You can use another element table if desired. -The table file must be in your C directory. +The table file must be put into a directory +where F is installed. +E.g. in F directory +when you have F. -By default, the file C is used. +By default, the filename F<"allkeys.txt"> is used. If C is passed explicitly as the value for this key, no file is read (but you can define collation elements via L). @@ -1489,13 +1477,6 @@ this module is based on. None by default. -=head2 TODO - -Unicode::Collate has not been ported to EBCDIC. -IMHO, use of utf8::unicode_to_native()/utf8::native_to_unicode() -at the proper postions should allow -this module to work on EBCDIC platform... - =head2 CAVEAT Use of the C parameter requires @@ -1526,7 +1507,7 @@ SADAHIRO Tomoyuki, ESADAHIRO@cpan.orgE http://homepage1.nifty.com/nomenclator/perl/ - Copyright(C) 2001-2002, SADAHIRO Tomoyuki. Japan. All rights reserved. + Copyright(C) 2001-2003, SADAHIRO Tomoyuki. Japan. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Unicode/Collate/Changes b/lib/Unicode/Collate/Changes index 2f7b6e7..92fdfeb 100644 --- a/lib/Unicode/Collate/Changes +++ b/lib/Unicode/Collate/Changes @@ -1,4 +1,8 @@ -Revision history for Perl extension Unicode::Collate. +Revision history for Perl module Unicode::Collate. + +0.25 Mon Jun 06 23:20:17 2003 + - fix Makefile.PL. + - internal tweak (again): pack_U() and unpack_U(). 0.24 Thu Apr 02 23:12:54 2003 - internal tweak for (?un)pack 'U'. diff --git a/lib/Unicode/Collate/README b/lib/Unicode/Collate/README index fc0f68f..8e4a153 100644 --- a/lib/Unicode/Collate/README +++ b/lib/Unicode/Collate/README @@ -1,4 +1,4 @@ -Unicode/Collate version 0.24 +Unicode/Collate version 0.25 =============================== NAME @@ -54,7 +54,7 @@ SADAHIRO Tomoyuki http://homepage1.nifty.com/nomenclator/perl/ - Copyright(C) 2001-2002, SADAHIRO Tomoyuki. Japan. All rights reserved. + Copyright(C) 2001-2003, SADAHIRO Tomoyuki. Japan. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Unicode/Collate/t/index.t b/lib/Unicode/Collate/t/index.t index 550cbe3..59ad8d7 100644 --- a/lib/Unicode/Collate/t/index.t +++ b/lib/Unicode/Collate/t/index.t @@ -1,6 +1,6 @@ BEGIN { - unless ("A" eq pack('U', 0x41) || "A" eq pack('U', ord("A"))) { + unless ("A" eq pack('U', 0x41)) { print "1..0 # Unicode::Collate " . "cannot stringify a Unicode code point\n"; exit 0; diff --git a/lib/Unicode/Collate/t/test.t b/lib/Unicode/Collate/t/test.t index 502e0b1..9221f5a 100644 --- a/lib/Unicode/Collate/t/test.t +++ b/lib/Unicode/Collate/t/test.t @@ -1,6 +1,6 @@ BEGIN { - unless ("A" eq pack('U', 0x41) || "A" eq pack('U', ord("A"))) { + unless ("A" eq pack('U', 0x41)) { print "1..0 # Unicode::Collate " . "cannot stringify a Unicode code point\n"; exit 0; -- 2.7.4