line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Exporter::Breaker::Parser::mab; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
382983
|
use Catmandu::Sane; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
20
|
|
4
|
2
|
|
|
2
|
|
557
|
use Moo; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
16
|
|
5
|
2
|
|
|
2
|
|
1332
|
use Catmandu::Breaker; |
|
2
|
|
|
|
|
33
|
|
|
2
|
|
|
|
|
58
|
|
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
|
252
|
my ($self, $data, $io) = @_; |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
33
|
|
|
17
|
my $identifier = $data->{_id} // $self->breaker->counter; |
21
|
|
|
|
|
|
|
|
22
|
5
|
|
|
|
|
9
|
my $record = $data->{record}; |
23
|
|
|
|
|
|
|
|
24
|
5
|
|
|
|
|
11
|
for my $field (@$record) { |
25
|
216
|
|
|
|
|
9127
|
my ($tag,$ind,@data) = @$field; |
26
|
|
|
|
|
|
|
|
27
|
216
|
|
|
|
|
499
|
$self->tags->{$tag} = 1; |
28
|
|
|
|
|
|
|
|
29
|
216
|
|
|
|
|
469
|
for (my $i = 0 ; $i < @data ; $i += 2) { |
30
|
222
|
100
|
100
|
|
|
931
|
if ($i == 0 && $data[$i] eq '_') { |
31
|
210
|
|
|
|
|
3653
|
$io->print( |
32
|
|
|
|
|
|
|
$self->breaker->to_breaker( |
33
|
|
|
|
|
|
|
$identifier , |
34
|
|
|
|
|
|
|
$tag , |
35
|
|
|
|
|
|
|
$data[$i+1]) |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
12
|
|
|
|
|
208
|
$io->print( |
40
|
|
|
|
|
|
|
$self->breaker->to_breaker( |
41
|
|
|
|
|
|
|
$identifier , |
42
|
|
|
|
|
|
|
$tag . $data[$i] , |
43
|
|
|
|
|
|
|
$data[$i+1]) |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
5
|
|
|
|
|
229
|
1; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Catmandu::Exporter::Breaker::Parser::mab - handler for MAB2 format |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 DESCRIPTION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This L<Catmandu::Breaker> handler breaks MAB2 format. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 SEE ALSO |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
L<Catmandu::MARC> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |