textconv/Converter.pm

filter: Statementstmt 61.5% 24 / 39 Branchbran 50.0% 4 / 8 Conditioncond 50.0% 5 / 10 MC/DCmcdc 40.0% 2 / 5 Subroutinesub 41.6% 5 / 12 Podpod 0.0% 0 / 6 totaltotal 50.0% 40 / 80 CC 9 SCAR 14.2
CC
9
Cov
58%
check
6.0
textize
6.0
validate
6.0
CRAP 4.2
« textconv/pdf.pm ↑ Summary textconv/doc.pm »
1 package App::optex::textconv::Converter;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 22 ▶sub import {
Subroutine import: called CC=5 SCAR=16.1
7 22 my $pkg = $_[0];
8 22 my $caller = caller;
9  
10 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 22 ▶ if ($pkg eq __PACKAGE__ and @_ > 1 and $_[1] eq "import") {
Branch: 1 branch
BranchTrueFalseTotal
if ($pkg eq __PACKAGE__ and @_ > 1 and $_[1] eq "import") 9 13 22
Condition83%5/6
$pkg eq __PACKAGE__ and @_ > 1 and $_[1] eq "import"
!ll&&!rl&&r
1309
$pkg eq __PACKAGE__ and @_ > 1
!ll&&!rl&&r
1219
MC/DC66%2/3
$pkg eq __PACKAGE__ and @_ > 1 and $_[1] eq "import"
$pkg eq __PACKAGE__ @_ > 1 $_[1] eq "import"
Truth table75%3/4
A and B and C
A= $pkg eq __PACKAGE__B= @_ > 1C= $_[1] eq "import"
ABCresult
0XX0
10X0
1100
1111
13 9 *{"$caller\::import"} = \&import;
14 9 return;
15 }
16  
17 13 ▶ if (@_ > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 1) 1 12 13
18 1 ▶ use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 goto &Exporter::import;
20 }
21  
22 unshift @App::optex::textconv::CONVERTER,
23 12 map { bless $_, __PACKAGE__ } @{"$pkg\::CONVERTER"};
24 }
25  
26 0 ▶sub check { $_[0]->[0] // die }
Subroutine check: not called CC=2 SCAR=17.9
Pod undocumented
Condition0%0/2
$_[0][0] // die()
l!l
00
MC/DC0%0/1
$_[0][0] // die()
$_[0][0]
Truth table0%0/2
A
A= $_[0][0]
Aresult
11
00
27 0 ▶sub textize { $_[0]->[1] // die }
Subroutine textize: not called CC=2 SCAR=17.9
Pod undocumented
Condition0%0/2
$_[0][1] // die()
l!l
00
MC/DC0%0/1
$_[0][1] // die()
$_[0][1]
Truth table0%0/2
A
A= $_[0][1]
Aresult
11
00
28 0 ▶sub validate {
Subroutine validate: not called CC=2 SCAR=17.9
Pod undocumented
29 0 my $obj = shift;
30 0 ▶ @$obj > 2 ? $obj->[2] : sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
@$obj > 2 ? : 0 0 0
31 }
32  
33 0 ▶sub treat {
Subroutine treat: not called CC=1 SCAR=6.9
Pod undocumented
34 0 my $obj = shift;
35 0 local $_ = shift;
36 0 test($obj->check);
37 }
38  
39 0 ▶sub isvalid {
Subroutine isvalid: not called CC=1 SCAR=6.9
Pod undocumented
40 0 my $obj = shift;
41 0 local $_ = shift;
42 0 test($obj->validate);
43 }
44  
45 0 ▶sub test {
Subroutine test: not called CC=2 SCAR=17.9
Pod undocumented
46 0 my $test = shift;
47 0 ▶ if (ref $test eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $test eq 'CODE') { } 0 0 0
48 0 $test->();
49 } else {
50 0 /$test/;
51 }
52 }
53  
54 1 1;
« textconv/pdf.pm ↑ Summary textconv/doc.pm »