blib/lib/EBook/Ishmael/EBook/XHTML.pm

filter: Statementstmt 95.4% 21 / 22 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 91.1% 31 / 34 CC 4 SCAR 9.3
CC
4
Cov
93%
heuristic
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
« blib/lib/EBook/Ishmael/CharDet/CP.pm ↑ Summary blib/lib/EBook/Ishmael/EBook.pm »
1 package EBook::Ishmael::EBook::XHTML;
2 17 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 17 our $VERSION = '2.04';
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::HTML';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 17 my $XHTML_NS = 'http://www.w3.org/1999/xhtml';
10  
11 sub heuristic {
12  
13 47 ▶ my $class = shift;
Subroutine heuristic: called CC=4 SCAR=14.0
Pod undocumented
14 47 my $file = shift;
15 47 my $fh = shift;
16  
17 47 ▶ return 1 if $file =~ /\.xhtml?$/;
Branch: 1 branch
BranchTrueFalseTotal
if $file =~ /\.xhtml?$/u 11 36 47
18 36 ▶ return 0 unless -T $fh;
Branch: 1 branch
BranchTrueFalseTotal
unless -T $fh 24 12 36
19  
20 12 read $fh, my ($head), 1024;
21  
22 12 ▶ return 0 unless $head =~ /<[^<>]+xmlns\s*=\s*"\Q$XHTML_NS\E"[^<>]*>/;
Branch: 1 branch
BranchTrueFalseTotal
unless $head =~ /<[^<>]+xmlns\s*=\s*"\Q$XHTML_NS\E"[^<>]*>/u 12 0 12
23  
24 0 return $head =~ /<\s*html[^<>]+>/;
25  
26 }
27  
28 17 1;
« blib/lib/EBook/Ishmael/CharDet/CP.pm ↑ Summary blib/lib/EBook/Ishmael/EBook.pm »