1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
Unicode/Collate version 0.95
===============================
NAME
Unicode::Collate - Unicode Collation Algorithm
SYNOPSIS
use Unicode::Collate;
#construct
$Collator = Unicode::Collate->new(%tailoring);
#sort
@sorted = $Collator->sort(@not_sorted);
#compare
$result = $Collator->cmp($a, $b); # returns 1, 0, or -1.
$result = $Collator->eq($a, $b); # returns true/false
(similarly ->ne, ->lt, ->le, ->gt, ->ge)
Note: Strings in @not_sorted, $a and $b are interpreted
according to Perl's Unicode support. See perlunicode,
perluniintro, perlunitut, perlunifaq, utf8.
Otherwise you can use "preprocess" or should decode them before.
INSTALL
Perl 5.6.1 or later is required.
Perl 5.8.1 or later is recommended.
Though this distribution contains a subset of an old DUCET, named
"keys.txt", this one is intended only for doing a test of this module
and practically useless for any other purpose.
Installation of Unicode::Collate::Locale requires Collate/Locale.pm,
Collate/Locale/*.pm, Collate/CJK/*.pm and Collate/allkeys.txt.
On building, Unicode::Collate::Locale doesn't require any of data/*.txt,
gendata/*, and mklocale.
Tests for Unicode::Collate::Locale are named t/loc_*.t.
Since 0.54, XSUB that requires a C compiler will be built by default.
To install this module type the following:
perl Makefile.PL
make
make test
make install
Even if a C compiler is not available, pure Perl (i.e. non-XS) edition
is available; type the following:
perl disableXS
perl Makefile.PL
make
make test
make install
If you decide to install XSUB edition after trying to build pure Perl,
type the following:
make clean
perl enableXS
perl Makefile.PL
make
make test
make install
DEPENDENCIES
The conformant collation requires Unicode::Normalize (v 0.10 or later)
although Unicode::Collate can be used without Unicode::Normalize.
ABOUT DUCET
Though this module can be used without any C<table> file,
to use this module easily, it is recommended to install a table file
in the UCA format, by copying it under the directory
<a place in @INC>/Unicode/Collate.
You can install such a table file by adding it to "Collate" directory
(where "keys.txt" is placed) in this distribution before executing
Makefile.PL.
The most preferable one is "The Default Unicode Collation Element Table"
(aka DUCET), available from the Unicode Consortium's website:
http://www.unicode.org/Public/UCA/
http://www.unicode.org/Public/UCA/latest/allkeys.txt (latest version)
If DUCET is not installed, it is recommended to copy the file
from http://www.unicode.org/Public/UCA/latest/allkeys.txt
to <a place in @INC>/Unicode/Collate/allkeys.txt manually.
HOW TO CHANGE DUCET (NOT WARRANTED)
0. rewriting UCA_Version and Base_Unicode_Version in Collate.pm
and t/version.t is preferred.
1. replace Collate/allkeys.txt with a new DUCET.
2. run mklocale to generate new Locale/*.pl and Korean.pm.
3. replace Collate/Locale/*.pl with the new Locale/*.pl,
and Collate/CJK/Korean.pm with the new Korean.pm.
4. make test.
IF FAIL, it may require more changes, not be easy.
AUTHOR, COPYRIGHT AND LICENSE
The Unicode::Collate module for perl was written by SADAHIRO Tomoyuki,
<SADAHIRO@cpan.org>. This module is Copyright(C) 2001-2012,
SADAHIRO Tomoyuki. Japan. All rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
The file Unicode/Collate/allkeys.txt was copied verbatim
from http://www.unicode.org/Public/UCA/6.2.0/allkeys.txt
For this file, Copyright (c) 2001-2012 Unicode, Inc.
Distributed under the Terms of Use in http://www.unicode.org/copyright.html
|