File Coverage

blib/lib/SWISH/Filters/xls2txt.pm
Criterion Covered Total %
statement 9 13 69.2
branch n/a
condition 0 2 0.0
subroutine 3 4 75.0
pod 1 2 50.0
total 13 21 61.9


line stmt bran cond sub pod time code
1             package SWISH::Filters::xls2txt;
2 1     1   1030 use strict;
  1         2  
  1         33  
3 1     1   4 use vars qw( $VERSION @ISA );
  1         1  
  1         152  
4             $VERSION = '0.191';
5             @ISA = ('SWISH::Filters::Base');
6              
7             sub new {
8 1     1 0 21 my $class = shift;
9 1         10 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         8 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__