Change 16398 by jhi@alpha on 2002/05/04 16:57:05
Subject: [Unicode::Collate] UCA Version number
From: SADAHIRO Tomoyuki <[EMAIL PROTECTED]>
Date: Sat, 04 May 2002 16:07:07 +0900
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
.... //depot/perl/lib/Unicode/Collate.pm#10 edit
.... //depot/perl/lib/Unicode/Collate/t/test.t#7 edit
Differences ...
==== //depot/perl/lib/Unicode/Collate.pm#10 (text) ====
Index: perl/lib/Unicode/Collate.pm
--- perl/lib/Unicode/Collate.pm.~1~ Sat May 4 11:00:05 2002
+++ perl/lib/Unicode/Collate.pm Sat May 4 11:00:05 2002
@@ -25,6 +25,29 @@
(our $Path = $INC{'Unicode/Collate.pm'}) =~ s/\.pm$//;
our $KeyFile = "allkeys.txt";
+our $UNICODE_VERSION;
+
+{
+ my($f, $fh);
+ foreach my $d (@INC) {
+ use File::Spec;
+ $f = File::Spec->catfile($d, "unicore", "version");
+ if (open($fh, $f)) {
+ chomp($UNICODE_VERSION = <$fh>);
+ close $fh;
+ last;
+ }
+
+ # XXX, Perl 5.6.1
+ $f = File::Spec->catfile($d, "unicode", "Unicode.301");
+ if (open($fh, $f)) {
+ $UNICODE_VERSION = "3.0.1";
+ close $fh;
+ last;
+ }
+ }
+}
+
our $getCombinClass; # coderef for combining class from Unicode::Normalize
use constant Min2 => 0x20; # minimum weight at level 2
@@ -33,6 +56,10 @@
our $DefaultRearrange = [ 0x0E40..0x0E44, 0x0EC0..0x0EC4 ];
+sub UCA_Version { "8.0" }
+
+sub Base_Unicode_Version { $UNICODE_VERSION }
+
##
## constructor
##
@@ -809,7 +836,7 @@
=back
-=head2 Other methods
+=head2 Methods for Collation
=over 4
@@ -913,6 +940,22 @@
=back
+=head2 Other Methods
+
+=over 4
+
+=item UCA_Version
+
+Returns the version number of Unicode Technical Standard 10
+this module consults.
+
+=item Base_Unicode_Version
+
+Returns the version number of the Unicode Standard
+this module is based on.
+
+=back
+
=head2 EXPORT
None by default.
==== //depot/perl/lib/Unicode/Collate/t/test.t#7 (text) ====
Index: perl/lib/Unicode/Collate/t/test.t
--- perl/lib/Unicode/Collate/t/test.t.~1~ Sat May 4 11:00:05 2002
+++ perl/lib/Unicode/Collate/t/test.t Sat May 4 11:00:05 2002
@@ -11,12 +11,17 @@
}
use Test;
-BEGIN { plan tests => 156 };
+BEGIN { plan tests => 160 };
use Unicode::Collate;
ok(1); # If we made it this far, we're ok.
#########################
+my $UCA_Version = "8.0";
+
+ok(Unicode::Collate::UCA_Version, $UCA_Version);
+ok(Unicode::Collate->UCA_Version, $UCA_Version);
+
my $Collator = Unicode::Collate->new(
table => 'keys.txt',
normalization => undef,
@@ -24,6 +29,9 @@
ok(ref $Collator, "Unicode::Collate");
+ok($Collator->UCA_Version, $UCA_Version);
+ok($Collator->UCA_Version(), $UCA_Version);
+
ok(
join(':', $Collator->sort(
qw/ lib strict Carp ExtUtils CGI Time warnings Math overload Pod CPAN /
@@ -585,8 +593,8 @@
ok($Collator ->lt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}"));
-# HIRAGANA and KATAKANA are undefined via ignoreName.
-# So they are after CJK Ideographs.
+# HIRAGANA and KATAKANA are made undefined via undefName.
+# So they are after CJK Unified Ideographs.
ok($backLevel2->lt("\x{4E00}", $hiragana));
ok($backLevel2->lt("\x{4E03}", $katakana));
End of Patch.