LibreCat / Catmandu-MARC

Catmandu modules for working with MARC data
https://metacpan.org/release/Catmandu-MARC
Other
8 stars 10 forks source link

Catmandu::Importer should be able to skip broken MARC records #78

Closed phochste closed 6 years ago

phochste commented 7 years ago

Ref. Email from Dan Michael:

When trying to import a MARC XML file, the program dies with:

Field 080 must have at least one subfield at
/usr/local/share/perl5/MARC/File/XML.pm line 483. [1]

What's a good strategy for ignoring or catching such errors? When
importing the same MARC directly from OAI using the marcxml handler, I
don't get any errors, but if I understand it right, the Catmandu-OAI
package doesn't use Marc::File::XML?

Perhaps this is really a question for the per4lib list, but I wanted to
check here first in case this is something that could/should be handled
with Catmandu-MARC.

Dan Michael

[1]
https://github.com/perl4lib/marc-perl/blob/e0de885347ad12bad129d467e603b25a03d88a73/marc-record/lib/MARC/Field.pm#L108
phochste commented 6 years ago

To skip faulty MARC records use the RAW parser:

catmandu convert MARC --type RAW < data.mrc

It will generate warnings on errors

phochste commented 6 years ago

The options --skip-errors is available in the dev branch

danmichaelo commented 6 years ago

35a111172031d2faee20d084a20169378200fb3a 🎉 👏