line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Exporter::Breaker::Parser::pica; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
386299
|
use Catmandu::Sane; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
20
|
|
4
|
2
|
|
|
2
|
|
572
|
use Moo; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
14
|
|
5
|
2
|
|
|
2
|
|
1325
|
use Catmandu::Breaker; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
70
|
|
6
|
2
|
|
|
2
|
|
14
|
use namespace::clean; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.141'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has tags => (is => 'ro' , default => sub { +{} }); |
11
|
|
|
|
|
|
|
has breaker => (is => 'lazy'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _build_breaker { |
14
|
1
|
|
|
1
|
|
26
|
Catmandu::Breaker->new; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub add { |
18
|
5
|
|
|
5
|
0
|
263
|
my ($self, $data, $io) = @_; |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
33
|
|
|
16
|
my $identifier = $data->{_id} // $self->breaker->counter; |
21
|
|
|
|
|
|
|
|
22
|
5
|
|
|
|
|
10
|
my $record = $data->{record}; |
23
|
|
|
|
|
|
|
|
24
|
5
|
|
|
|
|
15
|
for my $field (@$record) { |
25
|
367
|
|
|
|
|
37696
|
my ($tag, $occ, @data) = @$field; |
26
|
|
|
|
|
|
|
|
27
|
367
|
100
|
66
|
|
|
1221
|
if (defined $occ && $occ ne '') { |
28
|
162
|
|
|
|
|
379
|
$tag = "$tag\[$occ]"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
367
|
|
|
|
|
910
|
$self->tags->{$tag} = 1; |
32
|
|
|
|
|
|
|
|
33
|
367
|
|
|
|
|
777
|
for (my $i = 0 ; $i < @data ; $i += 2) { |
34
|
778
|
|
|
|
|
52952
|
$io->print( |
35
|
|
|
|
|
|
|
$self->breaker->to_breaker( |
36
|
|
|
|
|
|
|
$identifier, |
37
|
|
|
|
|
|
|
$tag . $data[$i], |
38
|
|
|
|
|
|
|
$data[$i+1]) |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
5
|
|
|
|
|
562
|
1; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Catmandu::Exporter::Breaker::Parser::pica - handler for PICA+ format |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This L<Catmandu::Breaker> handler breaks PICA+ format. Each path consists of a |
57
|
|
|
|
|
|
|
PICA tag, optionally followed by the occurrence in brackets, followed by the |
58
|
|
|
|
|
|
|
subfield code. This path format equals the format used by L<PICA::Path>, and |
59
|
|
|
|
|
|
|
Catmandu Fix methods such as L<Catmandu::Fix::pica_map>. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
C</> and the occurrence, followed by C<$> and |
62
|
|
|
|
|
|
|
the subfield code. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 SEE ALSO |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
L<Catmandu::PICA> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L<PICA::Data> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |