line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Unicode::CaseFold; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Unicode case-folding for case-insensitive lookups. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
BEGIN { |
6
|
1
|
|
|
1
|
|
32056
|
our $VERSION = '1.00'; # VERSION |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:ARODLAND'; # AUTHORITY |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
156
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
109
|
|
11
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
38
|
use 5.008001; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
48
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
5
|
use Scalar::Util 1.11 (); |
|
1
|
|
|
|
|
32
|
|
|
1
|
|
|
|
|
271
|
|
16
|
|
|
|
|
|
|
require Exporter; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
19
|
|
|
|
|
|
|
our @EXPORT_OK = qw(case_fold); |
20
|
|
|
|
|
|
|
our @EXPORT = qw(fc); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $SIMPLE_FOLDING; |
23
|
|
|
|
|
|
|
our $XS = 0; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
BEGIN { |
26
|
1
|
50
|
|
1
|
|
11
|
unless ($ENV{PERL_UNICODE_CASEFOLD_PP}) { |
27
|
1
|
|
|
|
|
2
|
local $@; |
28
|
1
|
|
|
|
|
2
|
eval { |
29
|
1
|
|
|
|
|
2
|
our $VERSION; |
30
|
1
|
|
|
|
|
5
|
require XSLoader; |
31
|
1
|
|
|
|
|
801
|
XSLoader::load(__PACKAGE__, |
32
|
|
|
|
|
|
|
exists $Unicode::CaseFold::{VERSION} |
33
|
1
|
50
|
|
|
|
5
|
? ${ $Unicode::CaseFold::{VERSION} } |
34
|
|
|
|
|
|
|
: () |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
}; |
37
|
1
|
50
|
33
|
|
|
11
|
die $@ if $@ && $@ !~ /object version|loadable object/; |
38
|
1
|
50
|
|
|
|
3
|
$XS = 1 unless $@; |
39
|
1
|
50
|
|
|
|
3
|
$SIMPLE_FOLDING = 0 unless $@; |
40
|
|
|
|
|
|
|
} |
41
|
1
|
50
|
|
|
|
117
|
if (!$XS) { |
42
|
0
|
|
|
|
|
0
|
require Unicode::CaseFoldPP; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub fc { |
47
|
99
|
50
|
|
99
|
1
|
71214
|
@_ = ($_) unless @_; |
48
|
99
|
|
|
|
|
2800
|
goto &case_fold; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
BEGIN { |
52
|
|
|
|
|
|
|
# Perl 5.10+ supports the (_) prototype which does the $_-defaulting for us, |
53
|
|
|
|
|
|
|
# and handles "lexical $_". Older perl doesn't, but we can fake it fairly |
54
|
|
|
|
|
|
|
# closely with a (;$) prototype. Older perl didn't have lexical $_ anyway. |
55
|
|
|
|
|
|
|
|
56
|
1
|
50
|
|
1
|
|
15
|
if ($^V ge v5.10.0) { |
57
|
1
|
|
|
|
|
36
|
Scalar::Util::set_prototype(\&fc, '_'); |
58
|
|
|
|
|
|
|
} else { |
59
|
0
|
|
|
|
|
0
|
Scalar::Util::set_prototype(\&fc, ';$'); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |