I'm using MARC-Record-2.0.0, and having problems when batch processing
records with (really) bad data.  Batch->strict_off isn't enough:
apparently USMARC.pm's decode() routine calls Field->new, which croaks
(dies), so the warning handling done by Batch->strict_off can't help.

I've attached a test file with 3 records (also at
http://www3.library.ucla.edu/~akohler/test.mrc).
The 2nd record's final field is bad, with tag "v.2":
LDR:00210cv  a22001093  4500
001:7999428
004:4295338
005:20070808092304.0
007:ta
008:0705290p    8   4001uueng0000000
852:0 $byr$hPL6201$i.L49 1998
v.2:  $a

Simplest code to reproduce:
#!/m1/shared/bin/perl -w
use MARC::Batch;
$batch = MARC::Batch->new('USMARC', $ARGV[0]);
$batch->strict_off();
while ( $record = $batch->next() ) {
    print $record->as_formatted();
}

I expected this code to print the good records, #1 and #3; instead,
only #1 prints, then the error: Tag "v.2" is not a valid tag. at ....
File/USMARC.pm line 221

Am I missing a setting which would allow MARC::Batch to process the
entire file, skipping records with bad data?  I've searched the
perl4lib archives, but only found messages suggesting strict_off()
should handle this.

For now, I'm working around this by wrapping my calls to batch->next()
in eval, but that's more awkward than I like.  Unfortunately, my perl
skills are too meager for me to try hacking a fix into the
MARC::Record modules myself.

Thanks for your help --Andy

Attachment: test.mrc
Description: Binary data

Reply via email to