line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
2
|
|
|
2
|
|
87819
|
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
11
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
2
|
|
|
2
|
|
12
|
use Catmandu::Expander (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
8
|
2
|
|
|
2
|
|
1262
|
use namespace::clean; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
41
|
|
9
|
2
|
|
|
2
|
|
11
|
use Catmandu::Fix::Has; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
10
|
2
|
|
|
2
|
|
845
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
18
|
|
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
|
18
|
|
18
|
3
|
|
|
|
|
20
|
if (defined(my $char = $self->sep)) { |
19
|
|
|
|
|
|
|
my $new_ref = {}; |
20
|
3
|
100
|
|
|
|
219
|
for my $key (keys %$ref) { |
21
|
1
|
|
|
|
|
5
|
my $val = $ref->{$key}; |
22
|
1
|
|
|
|
|
4
|
$key =~ s{\.}{$char}g; |
23
|
2
|
|
|
|
|
3
|
$new_ref->{$key} = $val; |
24
|
2
|
|
|
|
|
5
|
} |
25
|
2
|
|
|
|
|
6
|
$ref = $new_ref; |
26
|
|
|
|
|
|
|
} |
27
|
1
|
|
|
|
|
2
|
|
28
|
|
|
|
|
|
|
$ref; |
29
|
|
|
|
|
|
|
} |
30
|
3
|
|
|
|
|
31
|
|
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 |