Changeset 2785 for trunk/gsdl/perllib/plugin.pm
- Timestamp:
- 2001-10-09T17:21:29+13:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugin.pm
r2755 r2785 28 28 require util; 29 29 30 my $stats = {'num_processed' => 0, 31 'num_blocked' => 0, 32 'num_not_processed' => 0, 33 'num_archives' => 0 34 }; 35 30 36 sub load_plugins { 31 37 my ($plugin_list) = shift @_; 32 ($verbosity, $outhandle, $fail logname) = @_; # globals38 ($verbosity, $outhandle, $failhandle) = @_; # globals 33 39 my @plugin_objects = (); 34 40 35 41 $verbosity = 2 unless defined $verbosity; 36 42 $outhandle = STDERR unless defined $outhandle; 43 $failhandle = STDERR unless defined $failhandle; 37 44 38 45 foreach $pluginoptions (@$plugin_list) { … … 58 65 59 66 # initialize plugin 60 $plugobj->init($verbosity, $outhandle, $fail logname);67 $plugobj->init($verbosity, $outhandle, $failhandle); 61 68 62 69 # add this object to the list … … 94 101 return $rv if defined $rv; 95 102 } 103 104 if ($verbosity >= 2) { 105 print $outhandle "WARNING - no plugin could process $file\n"; 106 } 96 107 97 if ($verbosity >= 2) { 98 print $outhandle "WARNING - no plugin could process " . 99 &util::filename_cat($base_dir,$file) . "\n"; 108 $file =~ s/([^\\\/]+)$/$1/; 109 print $failhandle "$file: no plugin could process this file\n"; 110 $stats->{'num_not_processed'} ++; 111 112 return 0; 113 } 114 115 # write out some general stats that the plugins have compiled - note that 116 # the buildcol.pl process doesn't currently call this process so the stats 117 # are only output after import.pl - 118 sub write_stats { 119 my ($pluginfo, $statshandle) = @_; 120 121 foreach $plugobj (@$pluginfo) { 122 $plugobj->compile_stats($stats); 100 123 } 101 return 0; 124 125 my $total = $stats->{'num_processed'} + $stats->{'num_blocked'} + 126 $stats->{'num_not_processed'}; 127 128 if ($total == 1) { 129 print $statshandle "* 1 document was considered for processing\n"; 130 } else { 131 print $statshandle "* $total documents were considered for processing\n"; 132 } 133 if ($stats->{'num_archives'}) { 134 print $statshandle " (including the contents of " . $stats->{'num_archives'} . 135 " ZIP/TAR archive"; 136 if ($stats->{'num_archives'} == 1) {print $statshandle ")\n";} 137 else {print $statshandle "s)\n";} 138 } 139 if ($stats->{'num_processed'} == 1) { 140 print $statshandle "* 1 was processed and included in the collection\n"; 141 } else { 142 print $statshandle "* " . $stats->{'num_processed'} . " were processed and included in the collection\n"; 143 } 144 if ($stats->{'num_not_processed'} == 1) { 145 print $statshandle "* 1 was rejected."; 146 } else { 147 print $statshandle "* " . $stats->{'num_not_processed'} . " were rejected."; 148 } 149 print $statshandle " See the fail log for a list of rejected documents\n"; 150 102 151 } 103 152
Note:
See TracChangeset
for help on using the changeset viewer.