Catman...r::MARC(3pm)
π NAME π
Catmandu::Validator::MARC β bestie, this is the validator that checks your MARC records against a MARC21 Schema β¨
(also hi, this is the manual page for Catmandu::Validator::MARC, living in section 3pm of the User Contributed Perl Documentation, and it's giving very much "let's validate some records" energy π)
πΈ SYNOPSIS πΈ
Ok so first, the Perl code way:
use Catmandu::Validator::MARC;
Catmandu::Validator::MARC;
use DDP;
# load default MARC schema
my $validator = Catmandu::Validator::MARC->new();
# ... or load custom MARC schema
my $validator = Catmandu::Validator::MARC->new( schema => 'schema.json' );
my $importer = Catmandu::Importer::MARC->new(
file => 't/camel.mrc',
type => "ISO"
);
$importer->each( sub {
my $record = shift;
unless($validator->validate($record)){
p $_ for @{$validator->last_errors()};
}
});
And then, the Catmandu Fix language way (iykyk π«Ά):
# reject all items not conforming to the default MARC schema
select valid(., MARC)
# reject all items not conforming to a custom MARC schema
select valid(., MARC, schema: 'schema.json')
π¦ DESCRIPTION π¦
So this Catmandu::Validator is literally here to check MARC records against an MARC21 schema. Obsessed, honestly. π
If you want more info, go look at MARC::Schema and the writeup "MARC21 structure in JSON" at <https://pkiraly.github.io/2018/01/28/marc21-in-json/>.
Also!! If you're wondering how to actually use validators in Catmandu Fix language, check out Catmandu::Fix::validate and Catmandu::Fix::Condition::valid β those are your girls π
π CONFIGURATION π
schemaβ the MARC Schema, bestie! You can pass it as a filename (JSON) or as an instance ofMARC::Schema. Your choice, both slay β¨ignore_unknown_fieldsβ don't report fields that aren't included in the schema. Live your truth, ignore them πignore_unknown_subfieldsβ don't report subfields that aren't included in the schema. Same vibe, but subfields π
π AUTHOR π
Johann Rolschewski, <jorol at cpan> π«Ά
okay and that's the whole page, no cap β written by perl v5.38.2, dated 2024-08-03, from the Catmandu::Validator::MARC(3pm) page in the User Contributed Perl Documentation. validate responsibly, bestie πβ¨
π¦ where this page comes from
- debian trixie: libcatmandu-marc-perl 1.320-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatmandu-marc-perl 1.320-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-marc-perl 1.320-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms