I am planning to add xl2csv as another filter to parse MS Excel files besides the XLtoHTML.pm filter. I copied Doc2txt.pm and made it xls2csv.pm with the following changes:
package SWISH::Filters::xls2csv;
use vars qw/ %FilterInfo $VERSION /;
$VERSION = '0.01';
%FilterInfo = (
type => 2, # normal filter
priority => 50, # normal priority 1-100
);
sub filter {
my $filter = shift;
# Do we care about this document?
return unless $filter->content_type =~ m!application/vnd.ms-excel!;
# We need a file name to pass to the xls2csv program
my $file = $filter->fetch_filename;
# Grab output from running program
my $content = $filter->run_program( 'xls2csv', $file );
# update the document's content type
$filter->set_content_type( 'text/plain' );
How and where do I specify that xls files should be parsed by both filters. And how do I specify that the output of xls2csv should be parsed by the TXT2 parser?
Thank you for your help.
Received on Fri Jul 25 19:24:57 2003