line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
2
|
|
|
2
|
|
95130
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
16
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
2
|
|
|
2
|
|
17
|
use Catmandu::Expander (); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
13
|
|
8
|
2
|
|
|
2
|
|
1634
|
use namespace::clean; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
49
|
|
9
|
2
|
|
|
2
|
|
16
|
use Catmandu::Fix::Has; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
21
|
|
10
|
2
|
|
|
2
|
|
1010
|
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
16
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::Fix::Inlineable'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has sep => (fix_opt => 1, default => sub {undef}); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my ($self, $data) = @_; |
16
|
|
|
|
|
|
|
my $ref = Catmandu::Expander->collapse_hash($data); |
17
|
3
|
|
|
3
|
0
|
19
|
|
18
|
3
|
|
|
|
|
32
|
if (defined(my $char = $self->sep)) { |
19
|
|
|
|
|
|
|
my $new_ref = {}; |
20
|
3
|
100
|
|
|
|
227
|
for my $key (keys %$ref) { |
21
|
1
|
|
|
|
|
3
|
my $val = $ref->{$key}; |
22
|
1
|
|
|
|
|
3
|
$key =~ s{\.}{$char}g; |
23
|
2
|
|
|
|
|
4
|
$new_ref->{$key} = $val; |
24
|
2
|
|
|
|
|
8
|
} |
25
|
2
|
|
|
|
|
5
|
$ref = $new_ref; |
26
|
|
|
|
|
|
|
} |
27
|
1
|
|
|
|
|
3
|
|
28
|
|
|
|
|
|
|
$ref; |
29
|
|
|
|
|
|
|
} |
30
|
3
|
|
|
|
|
35
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=pod |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Catmandu::Fix::collapse - convert nested data into a flat hash using the TT2 dot convention |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SYNOPSIS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Collapse the data into a flat hash |
43
|
|
|
|
|
|
|
collapse() |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Collaps the data into a flat hash with '-' as path seperator |
46
|
|
|
|
|
|
|
collapse(-sep => '-') |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SEE ALSO |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
L<Catmandu::Fix> |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |