| 1 | package Catmandu::Fix::marc_append; | ||
| 2 | |||
| 3 | 1 | ▶ | use Catmandu::Sane; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Catmandu::MARC; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use Catmandu::Fix::Has; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 1 | with 'Catmandu::Fix::Inlineable'; | |
| 9 | |||
| 10 | 1 | our $VERSION = '1.33'; | |
| 11 | |||
| 12 | 1 | has marc_path => (fix_arg => 1); | |
| 13 | 1 | has value => (fix_arg => 1); | |
| 14 | |||
| 15 | 1 | ▶ | sub fix { |
|
Subroutine
fix: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 16 | 1 | my ($self,$data) = @_; | |
| 17 | 1 | my $marc_path = $self->marc_path; | |
| 18 | 1 | my $value = $self->value; | |
| 19 | 1 | return Catmandu::MARC->instance->marc_append($data,$marc_path,$value); | |
| 20 | } | ||
| 21 | |||
| 22 | =head1 NAME | ||
| 23 | |||
| 24 | Catmandu::Fix::marc_append - add a value at the end of a MARC field | ||
| 25 | |||
| 26 | =head1 SYNOPSIS | ||
| 27 | |||
| 28 | # Append a period at the end of the 100 field | ||
| 29 | marc_append(100,".") | ||
| 30 | |||
| 31 | =head1 DESCRIPTION | ||
| 32 | |||
| 33 | Append a value at the end of a MARC (sub)field | ||
| 34 | |||
| 35 | =head1 METHODS | ||
| 36 | |||
| 37 | =head2 marc_append(MARC_PATH , VALUE) | ||
| 38 | |||
| 39 | For each (sub)field matching the MARC_PATH append the VALUE to the last subfield. | ||
| 40 | This value can be a literal or reference an existing field in the record using the | ||
| 41 | dollar JSON_PATH syntax. | ||
| 42 | |||
| 43 | =head1 INLINE | ||
| 44 | |||
| 45 | This Fix can be used inline in a Perl script: | ||
| 46 | |||
| 47 | use Catmandu::Fix::marc_append as => 'marc_append'; | ||
| 48 | |||
| 49 | my $data = { record => [...] }; | ||
| 50 | |||
| 51 | $data = marc_append($data, '100', '.'); | ||
| 52 | |||
| 53 | =head1 SEE ALSO | ||
| 54 | |||
| 55 | L<Catmandu::Fix> | ||
| 56 | |||
| 57 | =cut | ||
| 58 | |||
| 59 | 1 | 1; | |