| 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
| |||||||||||||
| 16 | |||||||||||||
| 17 | 28 | ▶ | push @list, { | ||||||||||
|
Condition50%1/2
$anchor->textContent || 'none'
MC/DC0%0/1
$anchor->textContent || 'none'
$anchor->textContent
Truth table50%1/2
A
A= $anchor->textContent
| |||||||||||||
| 18 | title => $anchor->textContent || 'none', | ||||||||||||
| 19 | href => $href->value, | ||||||||||||
| 20 | }; | ||||||||||||
| 21 | } | ||||||||||||
| 22 | |||||||||||||
| 23 | 4 | ▶ | return wantarray ? @list : \@list; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 24 | } | ||||||||||||
| 25 | |||||||||||||
| 26 | 3 | 1; | |||||||||||