Parser.pm

filter: Statementstmt 100% 50 / 50 Branchbran n/a Conditioncond 50.0% 8 / 16 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 100% 18 / 18 Podpod 100% 7 / 7 totaltotal 82.1% 83 / 101 CC 7 SCAR 5.0
CC
7
Cov
88%
new
3.2
pages_manager
2.3
_load_epub
2.1
CRAP 1.6
« Parser/File/OPF/Context/Spine.pm ↑ Summary Parser/Util/Archive.pm »
1 package EPUB::Parser;
2 14 ▶use 5.008005;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 14 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 14 ▶use EPUB::Parser::Util::EpubLoad;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 14 ▶use EPUB::Parser::Util::Archive;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 14 ▶use EPUB::Parser::File::OPF;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 14 ▶use EPUB::Parser::File::Navi;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 14 ▶use EPUB::Parser::Manager::Pages;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 14 ▶use EPUB::Parser::Util::ShortcutMethod qw/
Subroutine BEGIN: called CC=1 SCAR=0.0
12 title creator language identifier
13 items_by_media items_by_media_type
14 toc_list
15 14 /;
16  
17  
18 14 our $VERSION = "0.07";
19  
20 15 ▶sub new {
Subroutine new: called CC=3 SCAR=11.7
Pod documented
21 15 my $class = shift;
22 15 ▶ my $args = shift || {};
Condition50%1/2
shift() || {}
l!l
015
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
23  
24 bless {
25 zip => '',
26 opf => '',
27 15 ▶ epub_version => $args->{epub_version} || '3.0',
Condition50%1/2
$args->{'epub_version'} || '3.0'
l!l
015
MC/DC0%0/1
$args->{'epub_version'} || '3.0'
$args->{'epub_version'}
Truth table50%1/2
A
A= $args->{'epub_version'}
Aresult
11
00
28 } => $class;
29 }
30  
31 31 ▶sub opf {
Subroutine opf: called CC=2 SCAR=7.1
Pod documented
32 31 my $self = shift;
33  
34 $self->{opf} ||= EPUB::Parser::File::OPF->new({
35 zip => $self->{zip},
36 epub_version => $self->{epub_version},
37 31 ▶ });
Condition66%2/3
$self->{"opf"} ||= "EPUB::Parser::File::OPF"->new({"zip", $self->{"zip"}, "epub_version", $self->{"epub_version"}})
l!l&&r!l&&!r
21100
MC/DC0%0/2
$self->{"opf"} ||= "EPUB::Parser::File::OPF"->new({"zip", $self->{"zip"}, "epub_version", $self->{"epub_version"}})
$self->{"opf"} "EPUB::Parser::File::OPF"->new({"zip", $self->{"zip"}, "epub_version", $self->{"epub_version"}})
Truth table66%2/3
A ||= B
A= $self->{"opf"}B= "EPUB::Parser::File::OPF"->new({"zip", $self->{"zip"}, "epub_version", $self->{"epub_version"}})
ABresult
1X1
011
000
38 }
39  
40 7 ▶sub navi {
Subroutine navi: called CC=2 SCAR=7.1
Pod documented
41 7 my $self = shift;
42  
43 $self->{navi} ||= EPUB::Parser::File::Navi->new({
44 zip => $self->{zip},
45 7 ▶ path => $self->opf->nav_path,
Condition66%2/3
$self->{"navi"} ||= "EPUB::Parser::File::Navi"->new({"zip", $self->{"zip"}, "path", $self->opf->nav_path})
l!l&&r!l&&!r
430
MC/DC0%0/2
$self->{"navi"} ||= "EPUB::Parser::File::Navi"->new({"zip", $self->{"zip"}, "path", $self->opf->nav_path})
$self->{"navi"} "EPUB::Parser::File::Navi"->new({"zip", $self->{"zip"}, "path", $self->opf->nav_path})
Truth table66%2/3
A ||= B
A= $self->{"navi"}B= "EPUB::Parser::File::Navi"->new({"zip", $self->{"zip"}, "path", $self->opf->nav_path})
ABresult
1X1
011
000
46 });
47 }
48  
49 1 ▶sub data_from_path {
Subroutine data_from_path: called CC=1 SCAR=0.0
Pod documented
50 1 my $self = shift;
51 1 my $path = shift;
52 1 $self->{zip}->get_member_data({ file_path => $path });
53 }
54  
55 1 ▶sub pages_manager {
Subroutine pages_manager: called CC=2 SCAR=8.1
Pod documented
56 1 my $self = shift;
57 1 ▶ $self->{pages_manager} ||= EPUB::Parser::Manager::Pages->new({
Condition33%1/3
$self->{"pages_manager"} ||= "EPUB::Parser::Manager::Pages"->new({"opf", $self->opf, "navi", $self->navi})
l!l&&r!l&&!r
010
MC/DC0%0/2
$self->{"pages_manager"} ||= "EPUB::Parser::Manager::Pages"->new({"opf", $self->opf, "navi", $self->navi})
$self->{"pages_manager"} "EPUB::Parser::Manager::Pages"->new({"opf", $self->opf, "navi", $self->navi})
Truth table33%1/3
A ||= B
A= $self->{"pages_manager"}B= "EPUB::Parser::Manager::Pages"->new({"opf", $self->opf, "navi", $self->navi})
ABresult
1X1
011
000
58 opf => $self->opf,
59 navi => $self->navi,
60 });
61 }
62  
63  
64 14 ▶sub _load_epub {
Subroutine _load_epub: called CC=2 SCAR=7.2
65 14 my ($self,$args,$method) = @_;
66 14 ▶ $self->{zip} ||= do {
Condition33%1/3
$self->{"zip"} ||= do { my $data = "EPUB::Parser::Util::EpubLoad"->$method($args); "EPUB::Parser::Util::Archive"->new({"data", $data}) }
l!l&&r!l&&!r
0140
MC/DC0%0/2
$self->{"zip"} ||= do { my $data = "EPUB::Parser::Util::EpubLoad"->$method($args); "EPUB::Parser::Util::Archive"->new({"data", $data}) }
$self->{"zip"} do { my $data = "EPUB::Parser::Util::EpubLoad"->$method($args); "EPUB::Parser::Util::Archive"->new({"data", $data}) }
Truth table33%1/3
A ||= B
A= $self->{"zip"}B= do { my $data = "EPUB::Parser::Util::EpubLoad"->$method($args); "EPUB::Parser::Util::Archive"->new({"data", $data}) }
ABresult
1X1
011
000
67 14 my $data = EPUB::Parser::Util::EpubLoad->$method($args);
68 14 EPUB::Parser::Util::Archive->new({ data => $data });
69 };
70 14 return $self;
71 }
72  
73 13 ▶sub load_file { _load_epub(@_, 'load_file' ) };
Subroutine load_file: called CC=1 SCAR=0.0
Pod documented
74 1 ▶sub load_binary { _load_epub(@_, 'load_binary') };
Subroutine load_binary: called CC=1 SCAR=0.0
Pod documented
75  
76 14 1;
77  
78 __END__
« Parser/File/OPF/Context/Spine.pm ↑ Summary Parser/Util/Archive.pm »