| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SWISH::Filters::xls2txt; |
|
2
|
1
|
|
|
1
|
|
766
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
28
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use vars qw( $VERSION @ISA ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
162
|
|
|
4
|
|
|
|
|
|
|
$VERSION = '0.190'; |
|
5
|
|
|
|
|
|
|
@ISA = ('SWISH::Filters::Base'); |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
|
8
|
1
|
|
|
1
|
0
|
18
|
my $class = shift; |
|
9
|
1
|
|
|
|
|
8
|
my $self = bless { |
|
10
|
|
|
|
|
|
|
mimetypes => [ qr!application/vnd.ms-excel!, qr!application/excel!, ], |
|
11
|
|
|
|
|
|
|
priority => 55, # higher than XLtoHTML |
|
12
|
|
|
|
|
|
|
}, $class; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# check for helpers |
|
15
|
1
|
|
|
|
|
7
|
return $self->set_programs('xls2csv'); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub filter { |
|
20
|
0
|
|
|
0
|
1
|
|
my ( $self, $doc ) = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
0
|
|
0
|
|
|
|
my $content = $self->run_xls2csv( $doc->fetch_filename ) || return; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# update the document's content type |
|
25
|
0
|
|
|
|
|
|
$doc->set_content_type('text/plain'); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# return the document |
|
28
|
0
|
|
|
|
|
|
return \$content; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
1; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |