source: trunk/gsdl/perllib/plugins/ExcelPlug.pm@ 10272

Last change on this file since 10272 was 10270, checked in by chi, 19 years ago

The modification to allow the secondary-plugin setting.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1###########################################################################
2#
3# ExcelPlug.pm -- plugin for importing Microsoft Excel files.
4# (currently only versions 95 and 97)
5#
6# A component of the Greenstone digital library software
7# from the New Zealand Digital Library Project at the
8# University of Waikato, New Zealand.
9#
10# Copyright (C) 2002 New Zealand Digital Library Project
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25#
26###########################################################################
27
28package ExcelPlug;
29
30use ConvertToPlug;
31use strict;
32no strict 'refs'; # allow filehandles to be variables and viceversa
33
34sub BEGIN {
35 @ExcelPlug::ISA = ('ConvertToPlug');
36}
37
38my $arguments =
39 [ { 'name' => "process_exp",
40 'desc' => "{BasPlug.process_exp}",
41 'type' => "regexp",
42 'reqd' => "no",
43 'deft' => &get_default_process_exp() }
44 ];
45
46my $options = { 'name' => "ExcelPlug",
47 'desc' => "{ExcelPlug.desc}",
48 'abstract' => "no",
49 'inherits' => "yes",
50 'args' => $arguments };
51
52sub new {
53 my ($class) = shift (@_);
54 my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
55 push(@$pluginlist, $class);
56
57 if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
58 if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
59
60 my $self = (defined $hashArgOptLists)? new ConvertToPlug($pluginlist,$inputargs,$hashArgOptLists): new ConvertToPlug($pluginlist,$inputargs);
61
62 $self = bless $self, $class;
63
64 my $secondary_plugin_options = $self->{'secondary_plugin_options'};
65 $self->load_secondary_plugins($class,$secondary_plugin_options);
66
67 return $self;
68}
69
70sub get_default_process_exp {
71 my $self = shift (@_);
72 return q^(?i)\.xls$^;
73}
74
75sub process {
76 my $self = shift (@_);
77 my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
78
79 return $self->process_type("xls",$base_dir,$file,$doc_obj);
80}
81
821;
Note: See TracBrowser for help on using the repository browser.