Changeset 6976 for trunk/gsdl/perllib
- Timestamp:
- 2004-03-09T14:14:56+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify/Hierarchy.pm
r6968 r6976 26 26 # classifier plugin for generating hierarchical classifications 27 27 28 # 12/05/02 Added usage datastructure - John Thompson29 # 12/05/02 Modified new() so as not to die on error, only on init() - John Thompson30 28 31 29 package Hierarchy; … … 95 93 "allow_extra_options")) { 96 94 97 $self->{'construction_error'} = "Incorrect options passed to $class, check your collect.cfg file."; 95 print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n"; 96 $self->print_txt_usage(""); # Use default resource bundle 97 die "\n"; 98 98 99 } 99 100 100 101 if (!$metadata) { 101 $self->{'construction_error'} = "Hierarchy error: no metadata supplied."; 102 print STDERR "$class: -metadata option REQUIRED \n"; 103 $self->print_txt_usage(""); # Use default resource bundle 104 105 die "$class: -metadata option REQUIRED\n"; 106 } 107 108 if (!$hfile) { 109 print STDERR "$class: -hfile option REQUIRED \n"; 110 $self->print_txt_usage(""); # Use default resource bundle 111 112 die "$class: -hfile option REQUIRED\n"; 102 113 } 103 114 … … 106 117 $sortname = $metadata unless ($sortname); 107 118 $sortname = undef if $sortname =~ /^nosort$/; 119 108 120 my $subjectfile; 109 110 if (!$hfile) { 111 $self->{'construction_error'} = "Hierarchy error: No -hfile supplied."; 112 } 113 else 114 { 115 $subjectfile = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"etc", $hfile); 121 $subjectfile = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"etc", $hfile); 122 if (!-e $subjectfile) { 123 my $collfile = $subjectfile; 124 $subjectfile = &util::filename_cat($ENV{'GSDLHOME'},"etc", $hfile); 116 125 if (!-e $subjectfile) { 117 my $collfile = $subjectfile; 118 $subjectfile = &util::filename_cat($ENV{'GSDLHOME'},"etc", $hfile); 119 if (!-e $subjectfile) { 120 my $outhandle = $self->{'outhandle'}; 121 $self->print_txt_usage(""); # Use default resource bundle 122 print STDERR "\nHierarchy Error: Can't locate subject file $hfile\n"; 123 print STDERR "This file should be in $collfile or $subjectfile\n"; 124 die "\n"; 125 } 126 my $outhandle = $self->{'outhandle'}; 127 print STDERR "\nHierarchy Error: Can't locate subject file $hfile\n"; 128 print STDERR "This file should be in $collfile or $subjectfile\n"; 129 $self->print_txt_usage(""); # Use default resource bundle 130 print STDERR "\nHierarchy Error: Can't locate subject file $hfile\n"; 131 print STDERR "This file should be in $collfile or $subjectfile\n"; 132 die "\n"; 126 133 } 127 134 } … … 140 147 sub init { 141 148 my $self = shift (@_); 142 143 if(defined $self->{'construction_error'} || !defined $self->{'metaname'} || !defined $self->{'subjectfile'}) {144 print STDERR "Error: " , $self->{'construction_error'} , "\n";145 $self->print_txt_usage(""); # Use default resource bundle146 die "\n";147 }148 149 149 150 # read in the subject file
Note:
See TracChangeset
for help on using the changeset viewer.