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

Last change on this file since 2785 was 2785, checked in by sjboddie, 23 years ago

The build process now creates a summary of how many files were included,
which were rejected, etc. A link to a page containing this summary is
provided from the final page of the collector (once the collection is built
successfully) and from the default "about this collection" text for
collections built by the collector.

Also did a little bit of tidying in a couple of places

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 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}
51
52&main ();
53
54sub main {
55 my $collect = "";
56
57 # Parse command line
58 if (!parsargv::parse(\@ARGV, 'collect.*/', \$collect)) {
59 &print_usage();
60 die "\n";
61 }
62
63 # Get classifier
64 my $classifier = shift (@ARGV);
65 if (!defined $classifier || $classifier eq "") {
66 print STDERR "You must provide a classifier name\n";
67 &print_usage();
68 die "\n";
69 }
70
71 # make sure the classifier is loaded from the correct location - a hack.
72 if ($collect ne "") {
73 $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
74 } else {
75 $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
76 }
77
78 my $classinfo = &classify::load_classifiers ([[$classifier]]);
79 my $classobj = shift @$classinfo;
80
81 print STDERR "
82$classifier info:
83
84Options may be passed to any classifier by including them in your collect.cfg
85configuration file.
86
87Classifiers may take two types of options:
88
89General options are defined within the base class (BasClas.pm) and are
90inherited by any classifier that has been correctly derived from BasClas.
91
92Specific options are defined within the classifier itself and are available
93only to this particular classifier.
94
95$classifier takes the following specific options:
96";
97 $classobj->print_usage();
98
99 print STDERR "$classifier takes the following general options
100";
101 &BasClas::print_general_usage($classifier);
102
103}
104
105
106
107
Note: See TracBrowser for help on using the repository browser.