Commit | Line | Data |
---|---|---|
bbce6d69 | 1 | package locale; |
2 | ||
b75c8c73 MS |
3 | our $VERSION = '1.00'; |
4 | ||
bbce6d69 | 5 | =head1 NAME |
6 | ||
7 | locale - Perl pragma to use and avoid POSIX locales for built-in operations | |
8 | ||
9 | =head1 SYNOPSIS | |
10 | ||
11 | @x = sort @y; # ASCII sorting order | |
12 | { | |
13 | use locale; | |
14 | @x = sort @y; # Locale-defined sorting order | |
15 | } | |
16 | @x = sort @y; # ASCII sorting order again | |
17 | ||
18 | =head1 DESCRIPTION | |
19 | ||
20 | This pragma tells the compiler to enable (or disable) the use of POSIX | |
21 | locales for built-in operations (LC_CTYPE for regular expressions, and | |
22 | LC_COLLATE for string comparison). Each "use locale" or "no locale" | |
23 | affects statements to the end of the enclosing BLOCK. | |
24 | ||
b8bc843f A |
25 | See L<perllocale> for more detailed information on how Perl supports |
26 | locales. | |
27 | ||
bbce6d69 | 28 | =cut |
29 | ||
2de3dbcc | 30 | $locale::hint_bits = 0x4; |
d5448623 | 31 | |
bbce6d69 | 32 | sub import { |
d5448623 | 33 | $^H |= $locale::hint_bits; |
bbce6d69 | 34 | } |
35 | ||
36 | sub unimport { | |
d5448623 | 37 | $^H &= ~$locale::hint_bits; |
bbce6d69 | 38 | } |
39 | ||
40 | 1; |