Changeset 8515
- Timestamp:
- 2004-11-11T14:20:55+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugin.pm
r7904 r8515 105 105 } 106 106 107 sub read { 108 my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $gli, $aux) = @_; 109 107 sub metadata_read { 108 my ($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli, $aux) = @_; 110 109 111 110 $maxdocs = -1 unless defined $maxdocs && $maxdocs =~ /\d/; 112 111 $gli = 0 unless defined $gli; 113 112 114 115 113 my $rv = 0; 116 114 my $glifile = $file; 117 115 118 116 $glifile =~ s/^[\/\\]+//; # file sometimes starts with a / so get rid of it 117 119 118 # Announce to GLI that we are handling a file 120 119 print STDERR "<File n='$glifile'>\n" if $gli; 121 122 120 123 121 # the .kill file is a handy (if not very elegant) way of aborting 124 122 # an import.pl or buildcol.pl process … … 127 125 die "\n"; 128 126 } 129 127 130 128 my $had_error = 0; 131 129 # pass this file by each of the plugins in turn until one … … 136 134 # 0 - blocked 137 135 # anything else for successful processing 136 138 137 foreach my $plugobj (@$pluginfo) { 139 $rv = $plugobj->read($pluginfo, $base_dir, $file, 138 139 $rv = $plugobj->metadata_read($pluginfo, $base_dir, $file, 140 $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli, $aux); 141 142 if (defined $rv) { 143 if ($rv == -1) { 144 # an error has occurred 145 $had_error = 1; 146 print STDERR "<ProcessingError n='$glifile'>\n" if $gli; 147 } else { 148 return $rv; 149 } 150 } # else undefined - was not recognised by the plugin 151 } 152 153 return 0; 154 } 155 156 sub read { 157 my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $gli, $aux) = @_; 158 159 $maxdocs = -1 unless defined $maxdocs && $maxdocs =~ /\d/; 160 $gli = 0 unless defined $gli; 161 162 my $rv = 0; 163 my $glifile = $file; 164 165 $glifile =~ s/^[\/\\]+//; # file sometimes starts with a / so get rid of it 166 167 # Announce to GLI that we are handling a file 168 print STDERR "<File n='$glifile'>\n" if $gli; 169 170 # the .kill file is a handy (if not very elegant) way of aborting 171 # an import.pl or buildcol.pl process 172 if (-e &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, ".kill")) { 173 gsprintf($outhandle, "{plugin.kill_file}\n"); 174 die "\n"; 175 } 176 177 my $had_error = 0; 178 # pass this file by each of the plugins in turn until one 179 # is found which will process it 180 # read must return: 181 # undef - could not recognise 182 # -1 - tried but error 183 # 0 - blocked 184 # anything else for successful processing 185 186 foreach my $plugobj (@$pluginfo) { 187 188 $rv = $plugobj->read($pluginfo, $base_dir, $file, 140 189 $metadata, $processor, $maxdocs, $gli, $aux); 141 if (defined $rv) { 190 191 if (defined $rv) { 142 192 if ($rv == -1) { 143 193 # an error has occurred … … 173 223 $stats->{'num_not_recognised'} ++; 174 224 } 175 176 225 return 0; 177 226 }
Note:
See TracChangeset
for help on using the changeset viewer.