line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Exporter::Breaker::Parser::json; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
387999
|
use Catmandu::Sane; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
17
|
|
4
|
2
|
|
|
2
|
|
460
|
use Moo; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
14
|
|
5
|
2
|
|
|
2
|
|
2048
|
use Catmandu::Expander; |
|
2
|
|
|
|
|
4736
|
|
|
2
|
|
|
|
|
18
|
|
6
|
2
|
|
|
2
|
|
1061
|
use Catmandu::Breaker; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
67
|
|
7
|
2
|
|
|
2
|
|
14
|
use namespace::clean; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.141'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has tags => (is => 'ro' , default => sub { +{} }); |
12
|
|
|
|
|
|
|
has breaker => (is => 'lazy'); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _build_breaker { |
15
|
1
|
|
|
1
|
|
12
|
Catmandu::Breaker->new; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub add { |
19
|
20
|
|
|
20
|
0
|
3789
|
my ($self, $data, $io) = @_; |
20
|
|
|
|
|
|
|
|
21
|
20
|
|
33
|
|
|
57
|
my $identifier = $data->{_id} // $self->breaker->counter; |
22
|
|
|
|
|
|
|
|
23
|
20
|
|
|
|
|
66
|
my $collapse = Catmandu::Expander->collapse_hash($data); |
24
|
20
|
|
|
|
|
7606
|
delete $collapse->{_id}; |
25
|
|
|
|
|
|
|
|
26
|
20
|
|
|
|
|
121
|
for my $tag (sort keys %$collapse) { |
27
|
191
|
|
|
|
|
10075
|
my $value = $collapse->{$tag}; |
28
|
|
|
|
|
|
|
|
29
|
191
|
|
|
|
|
806
|
$tag =~ s{\.\d+}{[]}g; |
30
|
|
|
|
|
|
|
|
31
|
191
|
|
|
|
|
458
|
$self->tags->{$tag} = 1; |
32
|
|
|
|
|
|
|
|
33
|
191
|
|
|
|
|
3273
|
$io->print( |
34
|
|
|
|
|
|
|
$self->breaker->to_breaker( |
35
|
|
|
|
|
|
|
$identifier , |
36
|
|
|
|
|
|
|
$tag , |
37
|
|
|
|
|
|
|
$value) |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
20
|
|
|
|
|
1276
|
1; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Catmandu::Exporter::Breaker::Parser::json - default handler |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This is the default L<Catmandu::Breaker> handler. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |