package MARC::Schema;
use strict;
use warnings;
our $VERSION = '0.16';
use Cpanel::JSON::XS;
use File::Share ':all';
use File::Slurper 'read_binary';
use Scalar::Util qw(reftype);
sub new {
my
ift;
my $json;
if ($self->{file}) {
$json = read_binary($self->{file});
}
else {
$self->{file} = dist_file('MARC-Schema', 'marc-schema.json');
$json = read_bina
ry($self->{file});
}
my $schema = decode_json($json);
return $schema->{fields};
}
sub check {
my ($self, $record, %options) = @_;
$record = $record->{record} if reftype $record