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 |
|
---|
30 | BEGIN {
|
---|
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 |
|
---|
37 | use strict;
|
---|
38 | use classify;
|
---|
39 | use util;
|
---|
40 | use parsargv;
|
---|
41 |
|
---|
42 | sub print_usage {
|
---|
43 | print STDERR "\n";
|
---|
44 | print STDERR "classinfo.pl: Prints information about a classifier.\n\n";
|
---|
45 | print STDERR " usage: $0 [options] classifier\n\n";
|
---|
46 | print STDERR " options:\n";
|
---|
47 | print STDERR " -collect collection-name Giving a collection name will make\n";
|
---|
48 | print STDERR " classinfo.pl look in collect/collection-name/perllib/classify\n";
|
---|
49 | print STDERR " first. If it doesn't find it there it will look in the general\n";
|
---|
50 | print STDERR " perllib/classify directory.\n\n";
|
---|
51 | }
|
---|
52 |
|
---|
53 | &main ();
|
---|
54 |
|
---|
55 | sub main {
|
---|
56 | my $collect = "";
|
---|
57 |
|
---|
58 | # Parse command line
|
---|
59 | if (!parsargv::parse(\@ARGV, 'collect.*/', \$collect)) {
|
---|
60 | &print_usage();
|
---|
61 | die "\n";
|
---|
62 | }
|
---|
63 |
|
---|
64 | # Get classifier
|
---|
65 | my $classifier = shift (@ARGV);
|
---|
66 | if (!defined $classifier || $classifier eq "") {
|
---|
67 | print STDERR "You must provide a classifier name\n";
|
---|
68 | &print_usage();
|
---|
69 | die "\n";
|
---|
70 | }
|
---|
71 |
|
---|
72 | # make sure the classifier is loaded from the correct location - a hack.
|
---|
73 | if ($collect ne "") {
|
---|
74 | $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
|
---|
75 | } else {
|
---|
76 | $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
|
---|
77 | }
|
---|
78 |
|
---|
79 | my $classinfo = &classify::load_classifiers ([[$classifier]]);
|
---|
80 | my $classobj = shift @$classinfo;
|
---|
81 |
|
---|
82 | print STDERR "
|
---|
83 | $classifier info:
|
---|
84 |
|
---|
85 | Options may be passed to any classifier by including them in your collect.cfg
|
---|
86 | configuration file.
|
---|
87 |
|
---|
88 | Classifiers may take two types of options:
|
---|
89 |
|
---|
90 | General options are defined within the base class (BasClas.pm) and are
|
---|
91 | inherited by any classifier that has been correctly derived from BasClas.
|
---|
92 |
|
---|
93 | Specific options are defined within the classifier itself and are available
|
---|
94 | only to this particular classifier.
|
---|
95 |
|
---|
96 | $classifier takes the following specific options:
|
---|
97 | ";
|
---|
98 | $classobj->print_usage();
|
---|
99 |
|
---|
100 | print STDERR "$classifier takes the following general options
|
---|
101 | ";
|
---|
102 | &BasClas::print_general_usage($classifier);
|
---|
103 |
|
---|
104 | }
|
---|
105 |
|
---|
106 |
|
---|
107 |
|
---|
108 |
|
---|