line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package EBook::EPUB::Check; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
137683
|
use 5.008_001; |
|
2
|
|
|
|
|
20
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
43
|
|
5
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
44
|
|
6
|
2
|
|
|
2
|
|
9
|
use Carp (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
39
|
|
7
|
2
|
|
|
2
|
|
9
|
use Exporter qw/import/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
57
|
|
8
|
2
|
|
|
2
|
|
628
|
use File::ShareDir (); |
|
2
|
|
|
|
|
12275
|
|
|
2
|
|
|
|
|
46
|
|
9
|
2
|
|
|
2
|
|
753
|
use IPC::Run3 (); |
|
2
|
|
|
|
|
60691
|
|
|
2
|
|
|
|
|
43
|
|
10
|
2
|
|
|
2
|
|
579
|
use EBook::EPUB::Check::Result (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
315
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = "0.05"; |
13
|
|
|
|
|
|
|
our @EXPORT = qw(epubcheck); |
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $JAR = File::ShareDir::dist_file('EBook-EPUB-Check', 'epubcheck-3.0.1/epubcheck-3.0.1.jar'); |
17
|
|
|
|
|
|
|
$JAR = Cygwin::posix_to_win_path($JAR) if $^O eq 'cygwin'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub epubcheck |
20
|
|
|
|
|
|
|
{ |
21
|
1
|
|
|
1
|
1
|
4756
|
my ($epub, $jar) = @_; |
22
|
|
|
|
|
|
|
|
23
|
1
|
50
|
|
|
|
11
|
$jar = $JAR unless defined $jar; |
24
|
|
|
|
|
|
|
|
25
|
1
|
50
|
|
|
|
31
|
Carp::croak('jar file not found') unless -f $jar; |
26
|
|
|
|
|
|
|
|
27
|
1
|
50
|
33
|
|
|
22
|
if ( ! defined $epub || ! -f $epub ) |
28
|
|
|
|
|
|
|
{ |
29
|
0
|
|
|
|
|
0
|
Carp::carp('epub file not found'); |
30
|
0
|
|
|
|
|
0
|
return EBook::EPUB::Check::Result->new(\''); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
3
|
my $out; |
34
|
1
|
|
|
|
|
15
|
IPC::Run3::run3(['java', '-jar', $jar, $epub], undef, \$out, \$out); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return EBook::EPUB::Check::Result->new(\$out); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |