blib/lib/EBook/Ishmael/EBook/KF8.pm

filter: Statementstmt 100% 34 / 34 Branchbran 83.3% 5 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 92.1% 47 / 51 CC 5 SCAR 11.7
CC
5
Cov
95%
heuristic
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.2
« blib/lib/EBook/Ishmael/EBook/CB.pm ↑ Summary blib/lib/EBook/Ishmael/EBook/Text.pm »
1 package EBook::Ishmael::EBook::KF8;
2 17 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 17 our $VERSION = '2.03';
4 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 17 ▶use parent 'EBook::Ishmael::EBook::Mobi';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 17 my $TYPE = 'BOOK';
10 17 my $CREATOR = 'MOBI';
11  
12 sub heuristic {
13  
14 81 ▶ my $class = shift;
Subroutine heuristic: called CC=5 SCAR=16.1
Pod undocumented
15 81 my $file = shift;
16 81 my $fh = shift;
17  
18 81 ▶ return 0 unless -s $file >= 68;
Branch: 1 branch
BranchTrueFalseTotal
unless -s $file >= 68 0 81 81
19  
20 81 seek $fh, 32, 0;
21 81 read $fh, my ($null), 1;
22  
23 81 ▶ unless ($null eq "\0") {
Branch: 1 branch
BranchTrueFalseTotal
unless ($null eq "\0") 35 46 81
24 35 return 0;
25 }
26  
27 46 seek $fh, 60, 0;
28 46 read $fh, my ($type), 4;
29 46 read $fh, my ($creator), 4;
30  
31 46 ▶ return 0 unless $type eq $TYPE && $creator eq $CREATOR;
Branch: 1 branch
BranchTrueFalseTotal
unless $type eq $TYPE and $creator eq $CREATOR 24 22 46
Condition66%2/3
$type eq $TYPE and $creator eq $CREATOR
!ll&&!rl&&r
24022
MC/DC50%1/2
$type eq $TYPE and $creator eq $CREATOR
$type eq $TYPE $creator eq $CREATOR
Truth table66%2/3
A and B
A= $type eq $TYPEB= $creator eq $CREATOR
ABresult
0X0
100
111
32  
33 22 seek $fh, 78, 0;
34 22 read $fh, my ($off), 4;
35 22 $off = unpack "N", $off;
36 22 seek $fh, $off + 36, 0;
37 22 read $fh, my ($ver), 4;
38 22 $ver = unpack "N", $ver;
39  
40 22 return $ver == 8;
41  
42 }
43  
44 17 1;
« blib/lib/EBook/Ishmael/EBook/CB.pm ↑ Summary blib/lib/EBook/Ishmael/EBook/Text.pm »