line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package EPUB::Parser::Util::EpubLoad; |
2
|
14
|
|
|
14
|
|
80
|
use strict; |
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
453
|
|
3
|
14
|
|
|
14
|
|
68
|
use warnings; |
|
14
|
|
|
|
|
27
|
|
|
14
|
|
|
|
|
313
|
|
4
|
14
|
|
|
14
|
|
67
|
use Carp; |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
1002
|
|
5
|
14
|
|
|
14
|
|
25327
|
use Archive::Zip qw/:ERROR_CODES/; |
|
14
|
|
|
|
|
1909353
|
|
|
14
|
|
|
|
|
5073
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub load_file { |
8
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
9
|
0
|
|
0
|
|
|
|
my $args = shift || {}; |
10
|
0
|
0
|
|
|
|
|
my $file_path = $args->{file_path} or croak "mandatory parameter 'file_path'"; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my $zip = Archive::Zip->new(); |
13
|
0
|
0
|
|
|
|
|
( $zip->read( $file_path ) == AZ_OK() ) or die 'read error'; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
return $zip; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub load_binary { |
19
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
20
|
0
|
|
0
|
|
|
|
my $args = shift || {}; |
21
|
0
|
0
|
|
|
|
|
my $zip_data = $args->{data} or croak "mandatory parameter 'data'"; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
require IO::String; |
24
|
0
|
|
|
|
|
|
my $zip = Archive::Zip->new(); |
25
|
0
|
0
|
|
|
|
|
( $zip->readFromFileHandle( IO::String->new($zip_data) ) == AZ_OK() ) or die 'open error'; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
return $zip; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |