blib/lib/Unicode/CaseFold.pm

filter: Statementstmt 94.5% 35 / 37 Branchbran 50.0% 8 / 16 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 79.1% 53 / 67 CC 10 SCAR 17.4
CC
10
Cov
79%
BEGIN
10.4
BEGIN
2.3
fc
2.1
CRAP 5.7
« blib/lib/Unicode/CaseFoldPP.pm ↑ Summary lib/Unicode/CaseFold.xs »
1 package Unicode::CaseFold;
2  
3 # ABSTRACT: Unicode case-folding for case-insensitive lookups.
4  
5 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 our $VERSION = '1.01'; # VERSION
7 }
8 1 our $AUTHORITY = 'cpan:ARODLAND'; # AUTHORITY
9  
10 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use Scalar::Util 1.11 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 require Exporter;
17  
18 1 our @ISA = qw(Exporter);
19 1 our @EXPORT_OK = qw(case_fold);
20 1 our @EXPORT = qw(fc);
21  
22 1 our $SIMPLE_FOLDING;
23 1 our $XS = 0;
24  
25 1 ▶BEGIN {
Subroutine BEGIN: called CC=8 SCAR=23.4
26 1 ▶ unless ($ENV{PERL_UNICODE_CASEFOLD_PP}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ENV{"PERL_UNICODE_CASEFOLD_PP"}) 1 0 1
27 1 local $@;
28 1 eval {
29 1 our $VERSION;
30 1 require XSLoader;
31 XSLoader::load(__PACKAGE__,
32 exists $Unicode::CaseFold::{VERSION}
33 1 ▶ ? ${ $Unicode::CaseFold::{VERSION} }
Branch: 1 branch
BranchTrueFalseTotal
exists $Unicode::CaseFold::{'VERSION'} ? : 1 0 1
34 : ()
35 );
36 };
37 1 ▶ die $@ if $@ && $@ !~ /object version|loadable object/;
Branch: 1 branch
BranchTrueFalseTotal
if $@ and not $@ =~ /object version|loadable object/ 0 1 1
Condition33%1/3
$@ and not $@ =~ /object version|loadable object/
!ll&&!rl&&r
100
MC/DC0%0/2
$@ and not $@ =~ /object version|loadable object/
$@ not $@ =~ /object version|loadable object/
Truth table33%1/3
A and not(B)
A= $@B= not $@ =~ /object version|loadable object/
ABresult
0X0
100
111
38 1 ▶ $XS = 1 unless $@;
Branch: 1 branch
BranchTrueFalseTotal
unless $@ 1 0 1
39 1 ▶ $SIMPLE_FOLDING = 0 unless $@;
Branch: 1 branch
BranchTrueFalseTotal
unless $@ 1 0 1
40 }
41 1 ▶ if (!$XS) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $Unicode::CaseFold::XS) 0 1 1
42 0 require Unicode::CaseFoldPP;
43 }
44 }
45  
46 99 ▶sub fc {
Subroutine fc: called CC=2 SCAR=7.2
Pod documented
47 99 ▶ @_ = ($_) unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 99 99
48 99 goto &case_fold;
49 }
50  
51 1 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=8.1
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 ▶ if ($^V ge v5.10.0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^V ge v5.10.0) { } 1 0 1
57 1 Scalar::Util::set_prototype(\&fc, '_');
58 } else {
59 0 Scalar::Util::set_prototype(\&fc, ';$');
60 }
61 }
62  
63 1 1;
64  
65 __END__
« blib/lib/Unicode/CaseFoldPP.pm ↑ Summary lib/Unicode/CaseFold.xs »