| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Catmandu::Fix::marc_append; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
742
|
use Catmandu::Sane; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
7
|
|
|
4
|
1
|
|
|
1
|
|
324
|
use Moo; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
5
|
1
|
|
|
1
|
|
688
|
use Catmandu::MARC; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
30
|
|
|
6
|
1
|
|
|
1
|
|
297
|
use Catmandu::Fix::Has; |
|
|
1
|
|
|
|
|
788
|
|
|
|
1
|
|
|
|
|
6
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with 'Catmandu::Fix::Inlineable'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.20'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has marc_path => (fix_arg => 1); |
|
13
|
|
|
|
|
|
|
has value => (fix_arg => 1); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub fix { |
|
16
|
1
|
|
|
1
|
0
|
2365
|
my ($self,$data) = @_; |
|
17
|
1
|
|
|
|
|
5
|
my $marc_path = $self->marc_path; |
|
18
|
1
|
|
|
|
|
4
|
my $value = $self->value; |
|
19
|
1
|
|
|
|
|
16
|
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_replace_all as => 'marc_replace_all'; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $data = { record => [...] }; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$data = marc_replace_all($data, '245a', 'test' , 'rest'); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
L<Catmandu::Fix> |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |