| 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() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | bless { | ||||||||||||||||||||
| 25 | zip => '', | ||||||||||||||||||||
| 26 | opf => '', | ||||||||||||||||||||
| 27 | 15 | ▶ | epub_version => $args->{epub_version} || '3.0', | ||||||||||||||||||
|
Condition50%1/2
$args->{'epub_version'} || '3.0'
MC/DC0%0/1
$args->{'epub_version'} || '3.0'
$args->{'epub_version'}
Truth table50%1/2
A
A= $args->{'epub_version'}
| |||||||||||||||||||||
| 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"}})
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"}})
| |||||||||||||||||||||
| 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})
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})
| |||||||||||||||||||||
| 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})
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})
| |||||||||||||||||||||
| 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})
}
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})
}
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||