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