root/trunk/gsdl/perllib/plugout.pm @ 13933

Revision 13933, 2.4 KB (checked in by shaoqun, 13 years ago)

make it check collection specific super classes first

  • Property svn:keywords set to Author Date Id Revision
Line 
1###########################################################################
2#
3# plugout.pm -- functions to handle using plugouts
4# A component of the Greenstone digital library software
5# from the New Zealand Digital Library Project at the
6# University of Waikato, New Zealand.
7#
8# Copyright (C) 1999 New Zealand Digital Library Project
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
24###########################################################################
25
26package plugout;
27
28use strict; # to pick up typos and undeclared variables...
29no strict 'refs'; # ...but allow filehandles to be variables and vice versa
30no strict 'subs';
31
32require util;
33use gsprintf 'gsprintf';
34
35# global variables
36my $stats = {'num_processed' => 0,
37         'num_blocked' => 0,
38         'num_not_processed' => 0,
39         'num_not_recognised' => 0,
40         'num_archives' => 0
41         };
42
43#globaloptions contains any options that should be passed to all plugins
44my ($verbosity, $outhandle, $failhandle, $globaloptions);
45
46sub load_plugout{
47    my ($plugoutname,$plugout_options) = @_;
48
49    my $colplugdir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"perllib/plugouts");
50     unshift (@INC, $colplugdir);
51
52    # find the plugout
53    my $colplugname = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"perllib/plugouts",
54                      "${plugoutname}.pm");
55    my $mainplugname = &util::filename_cat($ENV{'GSDLHOME'},"perllib/plugouts",
56                       "${plugoutname}.pm");
57    if (-e $colplugname) { require $colplugname; }
58    elsif (-e $mainplugname) { require $mainplugname; }
59    else {
60    &gsprintf(STDERR, "{plugout.could_not_find_plugout}\n",
61         $plugoutname);
62    die "\n";
63    }
64
65    # create a plugout object
66    my ($plugobj);
67
68    eval ("\$plugobj = new \$plugoutname([],\$plugout_options)");
69    die "$@" if $@;
70
71    return $plugobj;
72}
73
741;
Note: See TracBrowser for help on using the browser.