line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::optex::textconv::tika; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
918
|
use v5.14; |
|
1
|
|
|
|
|
4
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
7
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
55
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use App::optex::textconv::Converter 'import'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @CONVERTER = ( |
12
|
|
|
|
|
|
|
[ qr/\.doc[xm]?$/ => \&to_text ], |
13
|
|
|
|
|
|
|
[ qr/\.ppt[xm]?$/ => \&to_text ], |
14
|
|
|
|
|
|
|
[ qr/\.xls[xm]?$/ => \&to_text ], |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub to_text { |
18
|
0
|
|
|
0
|
0
|
|
my $file = shift; |
19
|
0
|
|
|
|
|
|
my $format = q(tika --text "%s"); |
20
|
0
|
|
|
|
|
|
my $exec = sprintf $format, $file; |
21
|
0
|
|
|
|
|
|
qx($exec); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |