Catman...r::MARC(3pm)

πŸ“¦
version 1.320 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’… 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 of MARC::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