| 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 |  | 64137 | our $VERSION = '1.01'; # VERSION | 
| 7 |  |  |  |  |  |  | } | 
| 8 |  |  |  |  |  |  | our $AUTHORITY = 'cpan:ARODLAND'; # AUTHORITY | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 1 |  |  | 1 |  | 7 | use strict; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 16 |  | 
| 11 | 1 |  |  | 1 |  | 4 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 20 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 1 |  |  | 1 |  | 18 | use 5.008001; | 
|  | 1 |  |  |  |  | 3 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 1 |  |  | 1 |  | 7 | use Scalar::Util 1.11 (); | 
|  | 1 |  |  |  |  | 18 |  | 
|  | 1 |  |  |  |  | 196 |  | 
| 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 |  | 6 | unless ($ENV{PERL_UNICODE_CASEFOLD_PP}) { | 
| 27 | 1 |  |  |  |  | 1 | local $@; | 
| 28 | 1 |  |  |  |  | 2 | eval { | 
| 29 | 1 |  |  |  |  | 1 | our $VERSION; | 
| 30 | 1 |  |  |  |  | 4 | require XSLoader; | 
| 31 |  |  |  |  |  |  | XSLoader::load(__PACKAGE__, | 
| 32 |  |  |  |  |  |  | exists $Unicode::CaseFold::{VERSION} | 
| 33 | 1 | 50 |  |  |  | 3 | ? ${ $Unicode::CaseFold::{VERSION} } | 
|  | 1 |  |  |  |  | 302 |  | 
| 34 |  |  |  |  |  |  | : () | 
| 35 |  |  |  |  |  |  | ); | 
| 36 |  |  |  |  |  |  | }; | 
| 37 | 1 | 50 | 33 |  |  | 7 | 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 |  |  |  | 82 | if (!$XS) { | 
| 42 | 0 |  |  |  |  | 0 | require Unicode::CaseFoldPP; | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | sub fc { | 
| 47 | 99 | 50 |  | 99 | 1 | 67561 | @_ = ($_) unless @_; | 
| 48 | 99 |  |  |  |  | 2178 | 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 |  | 10 | if ($^V ge v5.10.0) { | 
| 57 | 1 |  |  |  |  | 29 | Scalar::Util::set_prototype(\&fc, '_'); | 
| 58 |  |  |  |  |  |  | } else { | 
| 59 | 0 |  |  |  |  | 0 | Scalar::Util::set_prototype(\&fc, ';$'); | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  | } | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | 1; | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | __END__ |