19 |
use File::Path; |
use File::Path; |
20 |
use Time::HiRes qw/time/; |
use Time::HiRes qw/time/; |
21 |
use File::Slurp; |
use File::Slurp; |
22 |
|
use MARC::Record; |
23 |
|
|
24 |
=head1 NAME |
=head1 NAME |
25 |
|
|
235 |
|
|
236 |
$log->info("Using $normalize_path for normalization..."); |
$log->info("Using $normalize_path for normalization..."); |
237 |
|
|
238 |
|
my $marc_fh; |
239 |
|
if (my $path = $normalize->{marc21}) { |
240 |
|
open($marc_fh, '>', $path) || |
241 |
|
$log->logdie("can't open MARC output $path: $!"); |
242 |
|
|
243 |
|
$log->info("Creating MARC export file $path\n"); |
244 |
|
} |
245 |
|
|
246 |
# reset position in database |
# reset position in database |
247 |
$input_db->seek(1); |
$input_db->seek(1); |
248 |
|
|
281 |
id => $input->{name} . "/" . $mfn, |
id => $input->{name} . "/" . $mfn, |
282 |
ds => $ds, |
ds => $ds, |
283 |
type => $config->{$use_indexer}->{type}, |
type => $config->{$use_indexer}->{type}, |
284 |
) if ($indexer); |
) if ($indexer && $ds); |
285 |
|
|
286 |
|
if ($marc_fh) { |
287 |
|
my $marc = new MARC::Record; |
288 |
|
$marc->add_fields( WebPAC::Normalize::_get_marc21_fields() ); |
289 |
|
print $marc_fh $marc->as_usmarc; |
290 |
|
} |
291 |
|
|
292 |
$total_rows++; |
$total_rows++; |
293 |
} |
} |
294 |
|
|
295 |
$log->info("statistics of fields usage:\n", $input_db->stats) if ($stats); |
$log->info("statistics of fields usage:\n", $input_db->stats) if ($stats); |
296 |
|
|
297 |
}; |
# close MARC file |
298 |
|
close($marc_fh) if ($marc_fh); |
299 |
|
|
300 |
|
} |
301 |
|
|
302 |
} |
} |
303 |
|
|