blib/lib/Lingua/EO/Supersignoj.pm

filter: Statementstmt 83.0% 44 / 53 Branchbran 27.7% 5 / 18 Conditioncond 40.0% 4 / 10 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 84.6% 11 / 13 Podpod 100% 1 / 1 totaltotal 64.3% 65 / 101 CC 16 SCAR 23.7
CC
16
Cov
65%
transkodigu
21.2
u
5.7
U
5.7
CRAP 10.7
↑ Summary
1 package Lingua::EO::Supersignoj;
2 1 ▶use Attribute::Property;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '0.02';
7  
8 1 our %cxapeloj = (
9 h => [ qw/ Ch ch Gh gh Hh hh Jh jh Sh sh Uw uw / ],
10 H => [ qw/ CH ch GH gh HH hh JH jh SH sh UW uw / ],
11 x => [ qw/ Cx cx Gx gx Hx hx Jx jx Sx sx Ux ux / ],
12 X => [ qw/ CX cx GX gx HX hx JX jx SX sx UX ux / ],
13 poste => [ qw/ C^ c^ G^ g^ H^ h^ J^ j^ S^ s^ U^ u^ / ],
14 fronte => [ qw/ ^C ^c ^G ^g ^H ^h ^J ^j ^S ^s ^U ^u / ],
15 apostrofoj => [ qw/ C' c' G' g' H' h' J' j' S' s' U' u' / ],
16 iso => [ map chr,
17 198, 230, 216, 248, 166, 182, 172, 188, 222, 254, 221, 253 ],
18 unikodo => [ map chr,
19 264, 265, 284, 285, 292, 293, 308, 309, 348, 349, 364, 365 ]
20 );
21  
22 1 ▶sub nova : New;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶sub de : Property { exists $cxapeloj{$_} }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine de: called CC=1 SCAR=0.0
24 1 ▶sub al : Property { exists $cxapeloj{$_} }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine al: called CC=1 SCAR=0.0
25 0 ▶sub u : Property { $_ = [ $_ ] if not ref $_; ref $_ eq 'ARRAY' or !defined }
Subroutine BEGIN: called CC=1 SCAR=2.6
Subroutine u: not called CC=3 SCAR=17.3
Branch: 2 branches
BranchTrueFalseTotal
unless ref $_ 0 0 0
ref $_ eq "ARRAY" or not defined $_ 0 0 0
26 0 ▶sub U : Property { $_ = [ $_ ] if not ref $_; ref $_ eq 'ARRAY' or !defined }
Subroutine BEGIN: called CC=1 SCAR=2.6
Subroutine U: not called CC=3 SCAR=17.3
Branch: 2 branches
BranchTrueFalseTotal
unless ref $_ 0 0 0
ref $_ eq "ARRAY" or not defined $_ 0 0 0
27  
28 9 ▶sub transkodigu {
Subroutine transkodigu: called CC=12 SCAR=30.5
Pod documented
29 9 my ($mem, @tekstoj) = (@_);
30 9 my ($de, $al, $u, $U) = ($mem->de, $mem->al, $mem->u, $mem->U);
31 9 ▶ $U = [ map uc, @$u ] if $u and not $U;
Branch: 1 branch
BranchTrueFalseTotal
if $u and not $U 0 9 9
Condition33%1/3
$u and not $U
!ll&&!rl&&r
900
MC/DC0%0/2
$u and not $U
$u not $U
Truth table33%1/3
A and not(B)
A= $uB= not $U
ABresult
0X0
100
111
32 9 ▶ $u = [ map lc, @$U ] if $U and not $u;
Branch: 1 branch
BranchTrueFalseTotal
if $U and not $u 0 9 9
Condition33%1/3
$U and not $u
!ll&&!rl&&r
900
MC/DC0%0/2
$U and not $u
$U not $u
Truth table33%1/3
A and not(B)
A= $UB= not $u
ABresult
0X0
100
111
33 9 ▶ $de ||= 'X';
Condition50%1/2
$de ||= "X"
l!l
90
MC/DC0%0/1
$de ||= "X"
$de
Truth table50%1/2
A
A= $de
Aresult
11
00
34 9 ▶ $al ||= 'unikodo';
Condition50%1/2
$al ||= "unikodo"
l!l
90
MC/DC0%0/1
$al ||= "unikodo"
$al
Truth table50%1/2
A
A= $al
Aresult
11
00
35 my $modelfolio = join '|', map quotemeta,
36 $u
37 0 ? (@{ $cxapeloj{$de} }[ 0 .. 9 ], @$u)
38 9 ▶ : @{ $cxapeloj{$de} };
Branch: 1 branch
BranchTrueFalseTotal
$u ? : 0 9 9
39 my %transkodotabelo =
40 9 map { ($cxapeloj{$de}[$_] => $cxapeloj{$al}[$_]) } 0 .. 11;
41 9 ▶ if ($u) {
Branch: 1 branch
BranchTrueFalseTotal
if ($u) 0 9 9
42 0 delete @transkodotabelo{ @{ $cxapeloj{$de} }[10, 11] };
43 0 $transkodotabelo{$_} = $cxapeloj{$al}[10] for @$U;
44 0 $transkodotabelo{$_} = $cxapeloj{$al}[11] for @$u;
45 }
46 9 @tekstoj = map { $_ =~ s/($modelfolio)/$transkodotabelo{$1}/g; $_ } @tekstoj;
47 9 ▶ return wantarray ? @tekstoj : $tekstoj[-1];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 9 9
48 }
49  
50 1 1;
51  
52 __END__
↑ Summary