File Coverage

blib/lib/SWISH/Filters/Doc2txt.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::Doc2txt;
2 1     1   771 use strict;
  1         1  
  1         36  
3 1     1   6 use vars qw( $VERSION @ISA );
  1         2  
  1         248  
4             $VERSION = '0.190';
5             @ISA = ('SWISH::Filters::Base');
6              
7             sub new {
8 1     1 0 22 my ($class) = @_;
9              
10 1         13 my $self = bless {
11             mimetypes => [qr!application/(x-)?msword!]
12             , # list of types this filter handles
13             priority => 50
14             , # Make this a higher number (lower priority than the wvware filter
15             }, $class;
16              
17             # check for helpers
18 1         13 return $self->set_programs('catdoc');
19              
20             }
21              
22             sub filter {
23 0     0 1   my ( $self, $doc ) = @_;
24              
25 0   0       my $content = $self->run_catdoc( $doc->fetch_filename ) || return;
26              
27             # update the document's content type
28 0           $doc->set_content_type('text/plain');
29              
30             # return the document
31 0           return \$content;
32             }
33             1;
34              
35             __END__