35 |
|
|
36 |
=head1 VERSION |
=head1 VERSION |
37 |
|
|
38 |
Version 0.11 |
Version 0.12 |
39 |
|
|
40 |
=cut |
=cut |
41 |
|
|
42 |
our $VERSION = '0.11'; |
our $VERSION = '0.12'; |
43 |
|
|
44 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
45 |
|
|
504 |
my ($i1,$i2) = defined($marc_indicators->{$f}) ? @{ $marc_indicators->{$f} } : (' ',' '); |
my ($i1,$i2) = defined($marc_indicators->{$f}) ? @{ $marc_indicators->{$f} } : (' ',' '); |
505 |
my $m = [ $f, $i1, $i2 ]; |
my $m = [ $f, $i1, $i2 ]; |
506 |
|
|
507 |
|
warn "### marc_compose input subfields = ", dump(@_),$/ if ($debug > 2); |
508 |
|
|
509 |
while (@_) { |
while (@_) { |
510 |
my $sf = shift or die "marc_compose $f needs subfield"; |
my $sf = shift or die "marc_compose $f needs subfield"; |
511 |
my $v = shift; |
my $v = shift; |
516 |
warn "## ++ marc_compose($f,$sf,$v) ", dump( $m ),$/ if ($debug > 1); |
warn "## ++ marc_compose($f,$sf,$v) ", dump( $m ),$/ if ($debug > 1); |
517 |
} |
} |
518 |
|
|
519 |
warn "## marc_compose(d) ", dump( $m ),$/ if ($debug > 1); |
warn "## marc_compose current marc = ", dump( $m ),$/ if ($debug > 1); |
520 |
|
|
521 |
push @{ $marc_record->[ $marc_record_offset ] }, $m if ($#{$m} > 2); |
push @{ $marc_record->[ $marc_record_offset ] }, $m if ($#{$m} > 2); |
522 |
} |
} |
649 |
my $f = shift; |
my $f = shift; |
650 |
return unless (defined($rec && $rec->{$f})); |
return unless (defined($rec && $rec->{$f})); |
651 |
my $sf = shift; |
my $sf = shift; |
652 |
return map { $_->{$sf} } grep { ref($_) eq 'HASH' && $_->{$sf} } @{ $rec->{$f} }; |
return map { |
653 |
|
if (ref($_->{$sf}) eq 'ARRAY') { |
654 |
|
@{ $_->{$sf} }; |
655 |
|
} else { |
656 |
|
$_->{$sf}; |
657 |
|
} |
658 |
|
} grep { ref($_) eq 'HASH' && $_->{$sf} } @{ $rec->{$f} }; |
659 |
} |
} |
660 |
|
|
661 |
=head2 rec |
=head2 rec |
668 |
=cut |
=cut |
669 |
|
|
670 |
sub rec { |
sub rec { |
671 |
|
my @out; |
672 |
if ($#_ == 0) { |
if ($#_ == 0) { |
673 |
return rec1(@_); |
@out = rec1(@_); |
674 |
} elsif ($#_ == 1) { |
} elsif ($#_ == 1) { |
675 |
return rec2(@_); |
@out = rec2(@_); |
676 |
|
} |
677 |
|
if (@out) { |
678 |
|
return @out; |
679 |
|
} else { |
680 |
|
return ''; |
681 |
} |
} |
682 |
} |
} |
683 |
|
|
783 |
|
|
784 |
sub join_with { |
sub join_with { |
785 |
my $d = shift; |
my $d = shift; |
786 |
return join($d, grep { defined($_) && $_ ne '' } @_); |
warn "### join_with('$d',",dump(@_),")\n" if ($debug > 2); |
787 |
|
my $v = join($d, grep { defined($_) && $_ ne '' } @_); |
788 |
|
return '' unless defined($v); |
789 |
|
return $v; |
790 |
} |
} |
791 |
|
|
792 |
=head2 split_rec_on |
=head2 split_rec_on |