isa => sub {
my $t = $_[0];
is_string($t) && array_includes([qw(xml json)],$t) || die("type must be 'xml' or 'json'");
},
default => sub { 'xml'; },
lazy => 1
);
sub generator {
my($
Collection
state $mods = do {
#MODS::Record->from_json expects binary input (decode_json is applied)
if($self->type eq "json"){
$self->fh->binmode(":raw");
}
my $m
= $self->type eq "xml" ? MODS::Record->from_xml($self->fh) : MODS::Record->from_json($self->fh);
my $res = ref($m) eq "MODS::Element::Mods" ? [$m] : $m->mods;
$res;
};
return $i <