line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
19
|
|
|
19
|
|
222
|
use 5.10.1; |
|
19
|
|
|
|
|
55
|
|
2
|
19
|
|
|
19
|
|
91
|
use strict; |
|
19
|
|
|
|
|
32
|
|
|
19
|
|
|
|
|
515
|
|
3
|
19
|
|
|
19
|
|
93
|
use warnings; |
|
19
|
|
|
|
|
30
|
|
|
19
|
|
|
|
|
3620
|
|
4
|
|
|
|
|
|
|
package Data::Processor::Generator; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# make template: recursive tree traversal |
7
|
|
|
|
|
|
|
sub make_data_template{ |
8
|
17
|
|
|
17
|
0
|
16
|
my $schema_section = shift; |
9
|
|
|
|
|
|
|
|
10
|
17
|
|
|
|
|
16
|
my $data = {}; |
11
|
|
|
|
|
|
|
|
12
|
17
|
|
|
|
|
13
|
for my $key (sort keys %{$schema_section}){ |
|
17
|
|
|
|
|
31
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# data keys always are hashes in schema. |
15
|
26
|
100
|
|
|
|
43
|
if (ref $schema_section->{$key} eq ref {} ){ |
16
|
19
|
100
|
|
|
|
21
|
if ($key eq 'members'){ |
17
|
|
|
|
|
|
|
# "members" indicates children but is not written in data |
18
|
|
|
|
|
|
|
return make_data_template( |
19
|
5
|
|
|
|
|
11
|
$schema_section->{$key}, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
else{ |
23
|
14
|
100
|
|
|
|
19
|
if (exists $schema_section->{$key}->{description}){ |
24
|
|
|
|
|
|
|
$data->{$key} = $schema_section->{$key}->{description} |
25
|
8
|
|
|
|
|
21
|
} |
26
|
|
|
|
|
|
|
|
27
|
14
|
100
|
|
|
|
19
|
if (exists $schema_section->{$key}->{value}){ |
28
|
4
|
|
|
|
|
7
|
$data->{$key} .= $schema_section->{$key}->{value}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# we guess that if a section does not have a value |
32
|
|
|
|
|
|
|
# we might be interested in entering into it, too |
33
|
|
|
|
|
|
|
# Inversely, if there is a value, it is an end-point. |
34
|
14
|
100
|
|
|
|
22
|
if (! exists $schema_section->{$key}->{value}){ |
35
|
|
|
|
|
|
|
$data->{$key} = make_data_template( |
36
|
10
|
|
|
|
|
16
|
$schema_section->{$key}, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
12
|
|
|
|
|
23
|
return $data; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1 |