Parser/File/Navi/Context/Toc.pm

filter: Statementstmt 100% 24 / 24 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 87.1% 34 / 39 CC 5 SCAR 10.8
CC
5
Cov
90%
list
5.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.9
« Parser/Util/EpubLoad.pm ↑ Summary Parser/File/OPF/Context/Manifest.pm »
1 package EPUB::Parser::File::Navi::Context::Toc;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use parent 'EPUB::Parser::File::Navi::Context';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use List::Util qw/first/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # todo: nested
9 4 ▶sub list {
Subroutine list: called CC=5 SCAR=16.6
Pod undocumented
10 4 my $self = shift;
11 4 my @list;
12  
13 4 for my $anchor ( $self->parser->find('xhtml:ol/xhtml:li/xhtml:a') ) {
14 28 ▶ my $href = first { $_->name eq 'href' } $anchor->attributes();
Subroutine __ANON__: called CC=1 SCAR=0.0
15 28 ▶ croak 'parse error: ', $anchor->nodePath unless $href;
Branch: 1 branch
BranchTrueFalseTotal
unless $href 0 28 28
16  
17 28 ▶ push @list, {
Condition50%1/2
$anchor->textContent || 'none'
l!l
280
MC/DC0%0/1
$anchor->textContent || 'none'
$anchor->textContent
Truth table50%1/2
A
A= $anchor->textContent
Aresult
11
00
18 title => $anchor->textContent || 'none',
19 href => $href->value,
20 };
21 }
22  
23 4 ▶ return wantarray ? @list : \@list;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 4 4
24 }
25  
26 3 1;
« Parser/Util/EpubLoad.pm ↑ Summary Parser/File/OPF/Context/Manifest.pm »