initialize($conf);
-open OF, '>', $conf->{output};
-open XF, '>', $conf->{exception};
+open OF, '>', $conf->{output} or die "$0: cannot open output file $conf->{output}: $!\n";
+open XF, '>', $conf->{exception} or die "$0: cannot open exception file $conf->{output}: $!\n";
for my $file (@ARGV) {
print XF "Processing $file\n";
$batch->strict_off();
$batch->warnings_off();
- while ( $record = $batch->next ) {
+ my $record;
+ while ( 1 ) {
+ eval { $record = $batch->next; };
+ if ($@) {
+ import MARC::File::XML;
+ print "skipping bad record: $@\n";
+ next;
+ }
+ last unless $record;
$count++; progress_ticker();
my $marc = undef;
unless ( defined $record )
}
}
- if ($conf->{fingerprints}{koha_bib_id}) {
+ if ($conf->{fingerprints}{koha_bib_id} and exists $marc->{koha_bib_id}) {
print OF join("\t", $marc->{score}, $marc->{id}, "z_koha_bib_id",
$marc->{item_form}, $marc->{date1},
$marc->{record_type},