/usr/share/perl5/Catmandu/Fix/Inline/marc_add.pm is in libcatmandu-marc-perl 0.206-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | package Catmandu::Fix::Inline::marc_add;
use Clone qw(clone);
use Carp;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(marc_add);
%EXPORT_TAGS = (all => [qw(marc_add)]);
sub marc_add {
my ($data,$marc_path,@subfields) = @_;
my (%subfields) = @subfields;
my $ret = defined $data ? clone($data) : { record => [] };
$ret->{'record'} = [] unless $ret->{'record'};
croak "invalid marc path" unless $marc_path =~ /^\w{3}$/;
my @field = ();
push @field , $marc_path;
push @field , $subfields{ind1} // ' ';
push @field , $subfields{ind2} // ' ';
for (my $i = 0 ; $i < @subfields ; $i += 2) {
my $code = $subfields[$i];
next unless length $code == 1;
my $value = $subfields[$i+1];
push @field , $code;
push @field , $value;
}
push @{ $ret->{record} } , \@field;
return $ret;
}
=head1 NAME
Catmandu::Fix::Inline::marc_map - A marc_map-er for Perl scripts
=head1 SYNOPSIS
use Catmandu::Fix::Inline::marc_add qw(:all);
my $data = marc_add($data,'245', a => 'value' );
=head1 SEE ALSO
L<Catmandu::Fix::Inline::marc_map> , L<Catmandu::Fix::Inline::marc_remove>
=cut
1;
|