--- trunk/run.pl 2006/06/29 15:29:32 539 +++ trunk/run.pl 2006/06/29 15:29:41 540 @@ -19,6 +19,7 @@ use File::Path; use Time::HiRes qw/time/; use File::Slurp; +use MARC::Record; =head1 NAME @@ -234,6 +235,14 @@ $log->info("Using $normalize_path for normalization..."); + my $marc_fh; + if (my $path = $normalize->{marc21}) { + open($marc_fh, '>', $path) || + $log->logdie("can't open MARC output $path: $!"); + + $log->info("Creating MARC export file $path\n"); + } + # reset position in database $input_db->seek(1); @@ -272,14 +281,23 @@ id => $input->{name} . "/" . $mfn, ds => $ds, type => $config->{$use_indexer}->{type}, - ) if ($indexer); + ) if ($indexer && $ds); + + if ($marc_fh) { + my $marc = new MARC::Record; + $marc->add_fields( WebPAC::Normalize::_get_marc21_fields() ); + print $marc_fh $marc->as_usmarc; + } $total_rows++; } $log->info("statistics of fields usage:\n", $input_db->stats) if ($stats); - }; + # close MARC file + close($marc_fh) if ($marc_fh); + + } }