NAME

Catmandu::Validator::PICA - Validate PICA+ records with PICA Schema

SYNOPSIS

use Catmandu::Validator::PICA;
use Catmandu qw(importer);

my $validator = Catmandu::Validator::PICA->new( schema => 'pica-schema.json' );

importer('PICA', file => 'pica.xml')->each( sub {
    my $record = shift;
    unless($validator->validate($record)){
        say "$_" for @{$validator->last_errors()};
    }
}});

DESCRIPTION

This Catmandu::Validator can be used to check PICA+ records against a PICA::Schema. Either use it in Perl code or in Catmandu Fix language with Catmandu::Fix::Condition::valid:

# reject all items not conforming to a PICA schema
select valid('', PICA, schema: 'pica-schema.json')

CONFIGURATION

schema

PICA Schema given as hash reference, filename (JSON), or instance of PICA::Schema.

ignore_unknown_fields

Don't report fields not included in the schema.

ignore_unknown_subfields

Don't report subfields not included in the schema.

ignore_subfield_order

Don't report subfields in wrong order.