source: trunk/gsdl/bin/script/classinfo.pl@ 4118

Last change on this file since 4118 was 3541, checked in by kjdon, 22 years ago

added John T's changes into CVS - classinfo.pl and pluginfo.pl can now give back info in xml

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1#!/usr/bin/perl -w
2
3###########################################################################
4#
5# classinfo.pl -- provide information about classifiers
6#
7# A component of the Greenstone digital library software
8# from the New Zealand Digital Library Project at the
9# University of Waikato, New Zealand.
10#
11# Copyright (C) 1999 New Zealand Digital Library Project
12#
13# This program is free software; you can redistribute it and/or modify
14# it under the terms of the GNU General Public License as published by
15# the Free Software Foundation; either version 2 of the License, or
16# (at your option) any later version.
17#
18# This program is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with this program; if not, write to the Free Software
25# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26#
27###########################################################################
28
29
30BEGIN {
31 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
32 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
33 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
34 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/classify");
35}
36
37use classify;
38use util;
39use parsargv;
40
41sub print_usage {
42 print STDERR "\n";
43 print STDERR "classinfo.pl: Prints information about a classifier.\n\n";
44 print STDERR " usage: $0 [options] classifier\n\n";
45 print STDERR " options:\n";
46 print STDERR " -collect collection-name Giving a collection name will make\n";
47 print STDERR " classinfo.pl look in collect/collection-name/perllib/classify\n";
48 print STDERR " first. If it doesn't find it there it will look in the general\n";
49 print STDERR " perllib/classify directory.\n\n";
50 print STDERR " -xml Produces the information in an xml form, without\n";
51 print STDERR " 'pretty' comments but with much more detail.\n";
52}
53
54&main ();
55
56sub main {
57 my $collect = "";
58 my $xml = 0;
59
60 # Parse command line
61 if (!parsargv::parse(\@ARGV, q^collect/.*/^, \$collect, q^xml^, \$xml ))
62 {
63 &print_usage();
64 die "\n";
65 }
66
67 # Get classifier
68 my $classifier = shift (@ARGV);
69 if (!defined $classifier || $classifier eq "") {
70 print STDERR "You must provide a classifier name\n";
71 &print_usage();
72 die "\n";
73 }
74
75 # make sure the classifier is loaded from the correct location - a hack.
76 if ($collect ne "") {
77 $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
78 } else {
79 $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
80 }
81
82 my $classinfo = &classify::load_classifiers ([[$classifier]]);
83 my $classobj = shift @$classinfo;
84
85 if ($xml)
86 {
87 $classobj->print_xml_usage();
88 }
89 else
90 {
91 print STDERR "
92$classifier info:
93
94Options may be passed to any classifier by including them in your collect.cfg
95configuration file.
96
97Classifiers may take two types of options:
98
99General options are defined within the base class (BasClas.pm) and are
100inherited by any classifier that has been correctly derived from BasClas.
101
102Specific options are defined within the classifier itself and are available
103only to this particular classifier.
104
105$classifier takes the following specific options:
106";
107 $classobj->print_usage();
108
109 print STDERR "$classifier takes the following general options
110";
111 &BasClas::print_general_usage($classifier);
112 }
113}
114
115
116
117
Note: See TracBrowser for help on using the repository browser.