--- trunk/run.pl 2007/06/21 21:26:17 868 +++ trunk/run.pl 2007/08/23 20:28:10 882 @@ -299,7 +299,7 @@ # now WebPAC::Store # my $abs_path = abs_path($0); - $abs_path =~ s#/[^/]*$#/#; + $abs_path =~ s#/[^/]*$#/#; # my $db_path = $config->webpac('db_path'); @@ -315,6 +315,20 @@ debug => $debug, ); + # + # prepare output + # + my @outputs; + if (defined( $db_config->{output} )) { + my $module = $db_config->{output}->{module} || $log->logdie("need module in output section of $database"); + $module = 'WebPAC::Output::' . $module unless $module =~ m/::/; + $log->debug("loading output module $module"); + eval "require $module"; + my $out = new $module->new( $db_config->{output} ); + $out->init; + push @outputs, $out; + } + # # now, iterate through input formats @@ -507,7 +521,7 @@ my $mfn = $row->{'000'}->[0]; - if (! $mfn || $mfn !~ m#^\d+$#) { + if (! $mfn || $mfn !~ m{^\d+$}) { $log->warn("record $pos doesn't have valid MFN but '$mfn', using $pos"); $mfn = $pos; push @{ $row->{'000'} }, $pos; @@ -569,6 +583,13 @@ $log->info("Created $i instances of MFN $mfn\n") if ($i > 1); } + + foreach my $out ( @outputs ) { + if ( $out->can('add') ) { + $out->add( $mfn, $ds ); + } + } + } if ($validate) {