(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
our $DefaultRearrange = [ 0x0E40..0x0E44, 0x0EC0..0x0EC4 ];
+sub UCA_Version { "8.0" }
+
+sub Base_Unicode_Version { $UNICODE_VERSION }
+
##
## constructor
##
=back
-=head2 Other methods
+=head2 Methods for Collation
=over 4
=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.
}
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,
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 /
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));