diff options
author | SADAHIRO Tomoyuki <BQW10602@nifty.com> | 2002-05-05 01:07:07 +0900 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-05-04 16:57:05 +0000 |
commit | 3164dd77493d8c6d2197a3faf95daafb93006a96 (patch) | |
tree | f06bcd94190e9c75a4ad301a2a8a1efcb669a9b6 | |
parent | fa8a65806e20ffb61be982ce30fb168cdf5716ef (diff) | |
download | perl-3164dd77493d8c6d2197a3faf95daafb93006a96.tar.gz |
[Unicode::Collate] UCA Version number
Message-Id: <20020504160547.D7E0.BQW10602@nifty.com>
p4raw-id: //depot/perl@16398
-rw-r--r-- | lib/Unicode/Collate.pm | 45 | ||||
-rw-r--r-- | lib/Unicode/Collate/t/test.t | 14 |
2 files changed, 55 insertions, 4 deletions
diff --git a/lib/Unicode/Collate.pm b/lib/Unicode/Collate.pm index 6d6ed32439..e0dfbd39d6 100644 --- a/lib/Unicode/Collate.pm +++ b/lib/Unicode/Collate.pm @@ -25,6 +25,29 @@ our @EXPORT = (); (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 @@ use constant UNDEFINED => 0xFF80; # special value for undefined CE's our $DefaultRearrange = [ 0x0E40..0x0E44, 0x0EC0..0x0EC4 ]; +sub UCA_Version { "8.0" } + +sub Base_Unicode_Version { $UNICODE_VERSION } + ## ## constructor ## @@ -809,7 +836,7 @@ these tags doesn't work validly. =back -=head2 Other methods +=head2 Methods for Collation =over 4 @@ -913,6 +940,22 @@ is primary equal to C<"m>E<252>C<ss">. =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. diff --git a/lib/Unicode/Collate/t/test.t b/lib/Unicode/Collate/t/test.t index 957bad1f61..d6d72884d2 100644 --- a/lib/Unicode/Collate/t/test.t +++ b/lib/Unicode/Collate/t/test.t @@ -11,12 +11,17 @@ BEGIN { } 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 @@ my $Collator = Unicode::Collate->new( 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}")); 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)); |