1 | #!/usr/bin/perl -w
|
---|
2 |
|
---|
3 | ###########################################################################
|
---|
4 | #
|
---|
5 | # pluginfo.pl --
|
---|
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) 1999 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 |
|
---|
28 |
|
---|
29 | # This program will print info about a plugin
|
---|
30 |
|
---|
31 | BEGIN {
|
---|
32 | die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
|
---|
33 | die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
|
---|
34 | unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
|
---|
35 | unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugins");
|
---|
36 | }
|
---|
37 |
|
---|
38 | use strict;
|
---|
39 | use plugin;
|
---|
40 | use util;
|
---|
41 | use parsargv;
|
---|
42 |
|
---|
43 | sub print_usage {
|
---|
44 | print STDERR "\n usage: $0 [options] plugin\n\n";
|
---|
45 | print STDERR " options:\n";
|
---|
46 | print STDERR " -collect collection-name Giving a collection name will make pluginfo.pl\n";
|
---|
47 | print STDERR " look in collect/collection-name/perllib/plugins\n";
|
---|
48 | print STDERR " for plugin first. If it doesn't find it there\n";
|
---|
49 | print STDERR " it will look in the general perllib/plugins\n";
|
---|
50 | print STDERR " directory\n\n";
|
---|
51 | }
|
---|
52 |
|
---|
53 |
|
---|
54 | &main ();
|
---|
55 |
|
---|
56 | sub main {
|
---|
57 | my $collect = "";
|
---|
58 | if (!parsargv::parse(\@ARGV, 'collect.*/', \$collect)) {
|
---|
59 | &print_usage();
|
---|
60 | die "\n";
|
---|
61 | }
|
---|
62 |
|
---|
63 | my $plugin = shift (@ARGV);
|
---|
64 | if (!defined $plugin || $plugin eq "") {
|
---|
65 | print STDERR "You must provide a plugin name\n";
|
---|
66 | &print_usage();
|
---|
67 | die "\n";
|
---|
68 | }
|
---|
69 |
|
---|
70 | if ($collect ne "") {
|
---|
71 | $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
|
---|
72 | } else {
|
---|
73 | $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
|
---|
74 | }
|
---|
75 |
|
---|
76 | my $pluginfo = &plugin::load_plugins ([[$plugin]]);
|
---|
77 |
|
---|
78 | my $plugobj = shift @$pluginfo;
|
---|
79 |
|
---|
80 | print STDERR "\n$plugin info:\n\n";
|
---|
81 |
|
---|
82 | print STDERR "Options may be passed to any plugin by including them in your collect.cfg\n";
|
---|
83 | print STDERR "configuration file.\n\n";
|
---|
84 |
|
---|
85 | print STDERR "Plugins may take two types of options:\n\n";
|
---|
86 |
|
---|
87 | print STDERR "General options are defined within the base class (BasPlug.pm) and are\n";
|
---|
88 | print STDERR "inherited by any plugin that has been correctly derived from BasPlug.\n\n";
|
---|
89 |
|
---|
90 | print STDERR "Specific options are defined within the plugin itself and are available\n";
|
---|
91 | print STDERR "only to this particular plugin.\n\n";
|
---|
92 |
|
---|
93 | print STDERR "$plugin takes the following specific options:\n";
|
---|
94 | $plugobj->print_usage();
|
---|
95 |
|
---|
96 | print STDERR "$plugin takes the following general options\n";
|
---|
97 | &BasPlug::print_general_usage($plugin);
|
---|
98 |
|
---|
99 | print STDERR "The default process_exp for $plugin is\n";
|
---|
100 | print STDERR "\"" . $plugobj->get_default_process_exp() . "\"\n\n";
|
---|
101 |
|
---|
102 | print STDERR "The default block_exp for $plugin is\n";
|
---|
103 | print STDERR "\"" . $plugobj->get_default_block_exp() . "\"\n\n";
|
---|
104 |
|
---|
105 | }
|
---|
106 |
|
---|