Catmandu::Validator::PICA - Validate PICA+ records with an Avram Schema
In Perl code:
use Catmandu::Validator::PICA; use Catmandu qw(importer); my $validator = Catmandu::Validator::PICA->new( schema => 'schema.json' ); importer('PICA', file => 'pica.xml')->each( sub { my $record = shift; unless($validator->validate($record)){ say "$_" for @{$validator->last_errors()}; } });
In Catmandu Fix language:
# reject all items not conforming to the schema select valid('', PICA, schema: 'schema.json')
This Catmandu::Validator can be used to check PICA+ records against an Avram Schema language.
See also Catmandu::Fix::validate, and Catmandu::Fix::Condition::valid for usage of validators in Catmandu Fix language.
Avram Schema given as hash reference, filename (JSON or YAML), or instance of PICA::Schema.
Don't report fields not included in the schema.
Don't report subfields not included in the schema.
Don't report fields and subfields not included in the schema.
Don't report deprecated fields.
Don't report deprecated subfields.
Don't report deprecated codes.
Don't report deprecated fields, subfields, and codes.
Don't report errors resulting on wrong subfield order.
Don't check subfields at all.
To install Catmandu::PICA, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu::PICA
CPAN shell
perl -MCPAN -e shell install Catmandu::PICA
For more information on module installation, please visit the detailed CPAN module installation guide.