Changeset 2785 for trunk/gsdl/perllib/plugins
- Timestamp:
- 2001-10-09T17:21:29+13:00 (23 years ago)
- Location:
- trunk/gsdl/perllib/plugins
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/BasPlug.pm
r2755 r2785 142 142 143 143 $self->{'textcat'} = new textcat(); 144 145 $self->{'num_processed'} = 0; 146 $self->{'num_not_processed'} = 0; 147 $self->{'num_blocked'} = 0; 148 $self->{'num_archives'} = 0; 144 149 145 150 # general options available to all plugins … … 175 180 sub init { 176 181 my $self = shift (@_); 177 my ($verbosity, $outhandle, $fail logname) = @_;182 my ($verbosity, $outhandle, $failhandle) = @_; 178 183 179 184 # verbosity is passed through from the processor 180 185 $self->{'verbosity'} = $verbosity; 181 186 182 # as is the outhandle ...187 # as are the outhandle and failhandle 183 188 $self->{'outhandle'} = $outhandle if defined $outhandle; 184 $self->{'fail logname'} = $faillogname;189 $self->{'failhandle'} = $failhandle; 185 190 186 191 # set process_exp and block_exp to defaults unless they were … … 258 263 259 264 my $filename = &util::filename_cat($base_dir, $file); 260 return 0 if $self->{'block_exp'} ne "" && $filename =~ /$self->{'block_exp'}/; 265 if ($self->{'block_exp'} ne "" && $filename =~ /$self->{'block_exp'}/) { 266 $self->{'num_blocked'} ++; 267 return 0; 268 } 261 269 if ($filename !~ /$self->{'process_exp'}/ || !-f $filename) { 262 270 return undef; … … 298 306 if (!length ($text)) { 299 307 print $outhandle "$plugin_name: ERROR: $file contains no text\n" if $self->{'verbosity'}; 308 309 my $failhandle = $self->{'failhandle'}; 310 print $failhandle "$file: " . ref($self) . ": file contains no text\n"; 311 $self->{'num_not_processed'} ++; 312 300 313 return 0; 301 314 } … … 316 329 # process the document 317 330 $processor->process($doc_obj); 331 332 $self->{'num_processed'} ++; 318 333 319 334 return 1; # processed the file … … 671 686 } 672 687 688 sub compile_stats { 689 my $self = shift(@_); 690 my ($stats) = @_; 691 692 $stats->{'num_processed'} += $self->{'num_processed'}; 693 $stats->{'num_not_processed'} += $self->{'num_not_processed'}; 694 695 } 696 697 673 698 1; -
trunk/gsdl/perllib/plugins/ConvertToPlug.pm
r2755 r2785 48 48 # @ISA = ('BasPlug'); #, 'HTMLPlug', 'TEXTPlug'); 49 49 } 50 51 # use strict; # this breaks 'print $outhandle ' error msgs.52 50 53 51 sub print_usage { … … 146 144 my $outhandle = $self->{'outhandle'}; 147 145 my $convert_to = $self->{'convert_to'}; 146 my $failhandle = $self->{'failhandle'}; 148 147 149 148 # softlink to collection tmp dir … … 184 183 if ($output_type eq "fail") { 185 184 print $outhandle "Could not convert $tailname$suffix to $convert_to format\n"; 186 if ($self->{'faillogname'} ne "" && -s "$errlog") { 187 open(SAVELOG, ">>$self->{'faillogname'}"); 185 print $failhandle "$tailname$suffix: " . ref($self) . " failed to convert to $convert_to\n"; 186 $self->{'num_not_processed'} ++; 187 if (-s "$errlog") { 188 188 open(ERRLOG, "$errlog"); 189 print SAVELOG "$tailname$suffix (converting to $convert_to) failed:\n";190 189 while (<ERRLOG>) { 191 print SAVELOG"$_";190 print $outhandle "$_"; 192 191 } 192 print $outhandle "\n"; 193 193 close ERRLOG; 194 print SAVELOG "\n";195 close SAVELOG;196 194 } 197 195 &util::rm("$errlog") if (-e "$errlog"); … … 236 234 237 235 my $filename = &util::filename_cat($base_dir, $file); 238 return 0 if $self->{'block_exp'} ne "" && $filename =~ /$self->{'block_exp'}/; 236 if ($self->{'block_exp'} ne "" && $filename =~ /$self->{'block_exp'}/) { 237 $self->{'num_blocked'} ++; 238 return 0; 239 } 239 240 if ($filename !~ /$self->{'process_exp'}/ || !-f $filename) { 240 241 return undef; … … 299 300 $self->cleanup_tmp_area(); 300 301 302 $self->{'num_processed'} ++; 301 303 302 304 return 1; -
trunk/gsdl/perllib/plugins/PDFPlug.pm
r2661 r2785 63 63 64 64 my $outhandle = $self->{'outhandle'}; 65 print $outhandle "PDFPlug: passing $_[3] on to $self->{'convert_to'}Plug\n"65 print $outhandle "PDFPlug: passing $_[3] on to $self->{'convert_to'}Plug\n" 66 66 if $self->{'verbosity'} > 1; 67 67 … … 69 69 } 70 70 71 72 71 1; 73 74 75 76 -
trunk/gsdl/perllib/plugins/PSPlug.pm
r2451 r2785 33 33 } 34 34 35 use strict;36 37 38 35 sub new { 39 36 my $class = shift (@_); … … 65 62 print STDERR "using the PRESCRIPT package, which is available for download at\n http://www.nzdl.org/html/software.html\n\n"; 66 63 } 67 68 64 69 65 sub get_default_block_exp { … … 147 143 } 148 144 149 150 145 # do plugin specific processing of doc_obj for HTML type 151 146 sub process { … … 153 148 my ($trash, $trash2, $path, $file, $trash3, $doc) = @_; 154 149 155 print STDERR "PSPlug: passing $_[3] onto $self->{'convert_to'} Plug\n" 150 my $outhandle = $self->{'outhandle'}; 151 print $outhandle "PSPlug: passing $_[3] on to $self->{'convert_to'}Plug\n" 156 152 if $self->{'verbosity'} > 1; 157 153 -
trunk/gsdl/perllib/plugins/RTFPlug.pm
r2564 r2785 33 33 } 34 34 35 use strict;36 37 35 sub get_default_process_exp { 38 36 my $self = shift (@_); … … 42 40 sub process { 43 41 my $self = shift (@_); 44 print STDERR "RTFPlug: passing $_[3] onto $self->{'convert_to'} Plug\n" 42 43 my $outhandle = $self->{'outhandle'}; 44 print $outhandle "RTFPlug: passing $_[3] on to $self->{'convert_to'}Plug\n" 45 45 if $self->{'verbosity'} > 1; 46 46 47 return ConvertToPlug::process_type($self,"rtf",@_); 47 48 } -
trunk/gsdl/perllib/plugins/WordPlug.pm
r2515 r2785 45 45 46 46 my $outhandle = $self->{'outhandle'}; 47 print $outhandle "WordPlug: passing $_[3] on to $self->{'convert_to'}Plug\n"47 print $outhandle "WordPlug: passing $_[3] on to $self->{'convert_to'}Plug\n" 48 48 if $self->{'verbosity'} > 1; 49 49 … … 51 51 } 52 52 53 54 53 1; 55 -
trunk/gsdl/perllib/plugins/ZIPPlug.pm
r2082 r2785 119 119 my $numdocs = &plugin::read ($pluginfo, "", $tmpdir, $metadata, $processor, $maxdocs); 120 120 &util::rm_r ($tmpdir); 121 122 $self->{'num_archives'} ++; 123 121 124 return $numdocs; 122 125
Note:
See TracChangeset
for help on using the changeset viewer.