line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
19
|
|
|
19
|
|
235
|
use 5.10.1; |
|
19
|
|
|
|
|
60
|
|
2
|
19
|
|
|
19
|
|
115
|
use strict; |
|
19
|
|
|
|
|
38
|
|
|
19
|
|
|
|
|
583
|
|
3
|
19
|
|
|
19
|
|
123
|
use warnings; |
|
19
|
|
|
|
|
50
|
|
|
19
|
|
|
|
|
4122
|
|
4
|
|
|
|
|
|
|
package Data::Processor::Generator; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# make template: recursive tree traversal |
7
|
|
|
|
|
|
|
sub make_data_template{ |
8
|
17
|
|
|
17
|
0
|
20
|
my $schema_section = shift; |
9
|
|
|
|
|
|
|
|
10
|
17
|
|
|
|
|
20
|
my $data = {}; |
11
|
|
|
|
|
|
|
|
12
|
17
|
|
|
|
|
19
|
for my $key (sort keys %{$schema_section}){ |
|
17
|
|
|
|
|
36
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# data keys always are hashes in schema. |
15
|
26
|
100
|
|
|
|
57
|
if (ref $schema_section->{$key} eq ref {} ){ |
16
|
19
|
100
|
|
|
|
36
|
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
|
|
|
|
22
|
if (exists $schema_section->{$key}->{description}){ |
24
|
|
|
|
|
|
|
$data->{$key} = $schema_section->{$key}->{description} |
25
|
8
|
|
|
|
|
24
|
} |
26
|
|
|
|
|
|
|
|
27
|
14
|
100
|
|
|
|
21
|
if (exists $schema_section->{$key}->{value}){ |
28
|
4
|
|
|
|
|
11
|
$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
|
|
|
|
24
|
if (! exists $schema_section->{$key}->{value}){ |
35
|
|
|
|
|
|
|
$data->{$key} = make_data_template( |
36
|
10
|
|
|
|
|
22
|
$schema_section->{$key}, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
12
|
|
|
|
|
29
|
return $data; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1 |