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