blib/lib/EPUB/Parser/File/Navi.pm

filter: Statementstmt 100% 42 / 42 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 6 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 100% 13 / 13 Podpod 0.0% 0 / 8 totaltotal 78.0% 64 / 82 SCAR 17.9
CC
6
Cov
93%
parser
2.0
data
2.0
dir
2.0
CRAP 6.0
« blib/lib/EPUB/Parser/File/Document.pm ↑ Summary blib/lib/EPUB/Parser/Manager/Pages.pm »
1 package EPUB::Parser::File::Navi;
2 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 14 ▶use Smart::Args;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 14 ▶use EPUB::Parser::File::Parser::Navi;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 14 ▶use EPUB::Parser::File::Navi::Context;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub new {
9 3 ▶ args(
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
10 my $class => 'ClassName',
11 my $zip => { isa => 'EPUB::Parser::Util::Archive' },
12 my $path => 'Str',
13 );
14  
15 3 my $self = bless {
16 zip => $zip,
17 path => $path,
18 } => $class;
19  
20 3 $self->path($path);
21  
22 3 return $self;
23 }
24  
25 sub parser {
26 4 ▶ my $self = shift;
Subroutine parser: called CC=2 SCAR=7.1
Pod undocumented
27 $self->{parser}
28 4 ▶ ||= EPUB::Parser::File::Parser::Navi->new({ data => $self->data });
Condition66%2/3
$self->{"parser"} ||= "EPUB::Parser::File::Parser::Navi"->new({"data", $self->data})
l!l&&r!l&&!r
130
MC/DC0%0/2
$self->{"parser"} ||= "EPUB::Parser::File::Parser::Navi"->new({"data", $self->data})
$self->{"parser"} "EPUB::Parser::File::Parser::Navi"->new({"data", $self->data})
Truth table66%2/3
A ||= B
A= $self->{"parser"}B= "EPUB::Parser::File::Parser::Navi"->new({"data", $self->data})
ABresult
1X1
011
000
29 }
30  
31 sub path {
32 8 ▶ my $self = shift;
Subroutine path: called CC=1 SCAR=0.0
Pod undocumented
33 8 $self->{path};
34 }
35  
36 sub dir {
37 7 ▶ my $self = shift;
Subroutine dir: called CC=2 SCAR=7.0
Pod undocumented
38 7 require File::Basename;
39 7 ▶ $self->{dir} ||= File::Basename::dirname($self->path);
Condition66%2/3
$self->{"dir"} ||= File::Basename::dirname($self->path)
l!l&&r!l&&!r
610
MC/DC0%0/2
$self->{"dir"} ||= File::Basename::dirname($self->path)
$self->{"dir"} File::Basename::dirname($self->path)
Truth table66%2/3
A ||= B
A= $self->{"dir"}B= File::Basename::dirname($self->path)
ABresult
1X1
011
000
40 }
41  
42 sub data {
43 4 ▶ my $self = shift;
Subroutine data: called CC=2 SCAR=7.1
Pod undocumented
44 4 ▶ $self->{data} ||= $self->{zip}->get_member_data({ file_path => $self->path });
Condition66%2/3
$self->{"data"} ||= $self->{"zip"}->get_member_data({"file_path", $self->path})
l!l&&r!l&&!r
130
MC/DC0%0/2
$self->{"data"} ||= $self->{"zip"}->get_member_data({"file_path", $self->path})
$self->{"data"} $self->{"zip"}->get_member_data({"file_path", $self->path})
Truth table66%2/3
A ||= B
A= $self->{"data"}B= $self->{"zip"}->get_member_data({"file_path", $self->path})
ABresult
1X1
011
000
45 }
46  
47 sub context {
48 4 ▶ my $self = shift;
Subroutine context: called CC=2 SCAR=6.9
Pod undocumented
49 4 my $context_name = shift;
50 4 ▶ return $self->{$context_name} if $self->{$context_name};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{$context_name} 1 3 4
51  
52 3 $self->{$context_name} = EPUB::Parser::File::Navi::Context->new({
53 parser => $self->parser,
54 context_name => $context_name,
55 });
56 }
57  
58 4 ▶sub toc { shift->context('toc') }
Subroutine toc: called CC=1 SCAR=0.0
Pod undocumented
59  
60 sub chapter_list {
61 1 ▶ args(
Subroutine chapter_list: called CC=2 SCAR=7.0
Pod undocumented
62 my $self,
63 my $abs => { optional => 1 },
64 );
65 1 my $list = $self->toc->list;
66 1 ▶ if ($abs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($abs) 1 0 1
67 1 $list = [ map { $_ =~ s/\#.*$//; $_ } map { $self->dir . '/' . $_->{href} } @$list];
68 }
69 1 return $list;
70 }
71  
72 14 1;
« blib/lib/EPUB/Parser/File/Document.pm ↑ Summary blib/lib/EPUB/Parser/Manager/Pages.pm »