perl5.001 patch.1f
[p5sagit/p5-mst-13.2.git] / pod / modpods / Collate.pod
1 =head1 NAME
2
3 Collate - compare 8-bit scalar data according to the current locale
4
5 =head1 SYNOPSIS
6
7     use Collate;
8     setlocale(LC_COLLATE, 'locale-of-your-choice'); 
9     $s1 = new Collate "scalar_data_1";
10     $s2 = new Collate "scalar_data_2";
11
12 =head1 DESCRIPTION
13
14 This module provides you with objects that will collate 
15 according to your national character set, providing the 
16 POSIX setlocale() function should be supported on your system.
17
18 You can compare $s1 and $s2 above with
19
20     $s1 le $s2
21
22 to extract the data itself, you'll need a dereference: $$s1
23
24 This uses POSIX::setlocale The basic collation conversion is done by
25 strxfrm() which terminates at NUL characters being a decent C routine.
26 collate_xfrm() handles embedded NUL characters gracefully.  Due to C<cmp>
27 and overload magic, C<lt>, C<le>, C<eq>, C<ge>, and C<gt> work also.  The
28 available locales depend on your operating system; try whether C<locale
29 -a> shows them or the more direct approach C<ls /usr/lib/nls/loc> or C<ls
30 /usr/lib/nls>.  The locale names are probably something like
31 "xx_XX.(ISO)?8859-N".