9 |
|
|
10 |
tag search display |
tag search display |
11 |
marc marc_indicators marc_repeatable_subfield |
marc marc_indicators marc_repeatable_subfield |
12 |
marc_compose marc_leader |
marc_compose marc_leader marc_fixed |
13 |
marc_duplicate marc_remove marc_count |
marc_duplicate marc_remove marc_count |
14 |
marc_original_order |
marc_original_order |
15 |
|
|
42 |
|
|
43 |
=head1 VERSION |
=head1 VERSION |
44 |
|
|
45 |
Version 0.27 |
Version 0.28 |
46 |
|
|
47 |
=cut |
=cut |
48 |
|
|
49 |
our $VERSION = '0.27'; |
our $VERSION = '0.28'; |
50 |
|
|
51 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
52 |
|
|
517 |
} |
} |
518 |
} |
} |
519 |
|
|
520 |
|
=head2 marc_fixed |
521 |
|
|
522 |
|
Create control/indentifier fields with values in fixed positions |
523 |
|
|
524 |
|
marc_fixed('008', 00, '070402'); |
525 |
|
marc_fixed('008', 39, '|'); |
526 |
|
|
527 |
|
Positions not specified will be filled with spaces (C<0x20>). |
528 |
|
|
529 |
|
There will be no effort to extend last specified value to full length of |
530 |
|
field in standard. |
531 |
|
|
532 |
|
=cut |
533 |
|
|
534 |
|
sub marc_fixed { |
535 |
|
my ($f, $pos, $val) = @_; |
536 |
|
die "need marc(field, position, value)" unless defined($f) && defined($pos); |
537 |
|
|
538 |
|
my $update = 0; |
539 |
|
|
540 |
|
map { |
541 |
|
if ($_->[0] eq $f) { |
542 |
|
my $old = $_->[1]; |
543 |
|
if (length($old) < $pos) { |
544 |
|
$_->[1] .= ' ' x ( $pos - length($old) ) . $val; |
545 |
|
warn "## marc_fixed($f,$pos,'$val') append '$old' -> '$_->[1]'\n" if ($debug > 1); |
546 |
|
} else { |
547 |
|
$_->[1] = substr($old, 0, $pos) . $val . substr($old, $pos + length($val)); |
548 |
|
warn "## marc_fixed($f,$pos,'$val') update '$old' -> '$_->[1]'\n" if ($debug > 1); |
549 |
|
} |
550 |
|
$update++; |
551 |
|
} |
552 |
|
} @{ $marc_record->[ $marc_record_offset ] }; |
553 |
|
|
554 |
|
if (! $update) { |
555 |
|
my $v = ' ' x $pos . $val; |
556 |
|
push @{ $marc_record->[ $marc_record_offset ] }, [ $f, $v ]; |
557 |
|
warn "## marc_fixed($f,$pos,'val') created '$v'\n" if ($debug > 1); |
558 |
|
} |
559 |
|
} |
560 |
|
|
561 |
=head2 marc |
=head2 marc |
562 |
|
|
563 |
Save value for MARC field |
Save value for MARC field |