| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
19
|
|
|
19
|
|
203
|
use 5.10.1; |
|
|
19
|
|
|
|
|
48
|
|
|
2
|
19
|
|
|
19
|
|
73
|
use strict; |
|
|
19
|
|
|
|
|
29
|
|
|
|
19
|
|
|
|
|
314
|
|
|
3
|
19
|
|
|
19
|
|
72
|
use warnings; |
|
|
19
|
|
|
|
|
24
|
|
|
|
19
|
|
|
|
|
4067
|
|
|
4
|
|
|
|
|
|
|
package Data::Processor::Transformer; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# XXX document this with pod. (if standalone) |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
|
9
|
215
|
|
|
215
|
0
|
306
|
my $class = shift; |
|
10
|
|
|
|
|
|
|
|
|
11
|
215
|
|
|
|
|
279
|
my $self = {}; |
|
12
|
215
|
|
|
|
|
267
|
bless ($self, $class); |
|
13
|
215
|
|
|
|
|
940
|
return $self; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub transform { |
|
17
|
302
|
|
|
302
|
0
|
310
|
my $self = shift; |
|
18
|
302
|
|
|
|
|
286
|
my $key = shift; |
|
19
|
302
|
|
|
|
|
277
|
my $schema_key = shift; |
|
20
|
302
|
|
|
|
|
288
|
my $section = shift; |
|
21
|
302
|
100
|
|
|
|
447
|
if (exists $section->{schema}{$schema_key}{transformer}){ |
|
22
|
10
|
|
|
|
|
12
|
my $return_value; |
|
23
|
10
|
|
|
|
|
13
|
eval { |
|
24
|
10
|
|
|
|
|
30
|
local $SIG{__DIE__}; |
|
25
|
|
|
|
|
|
|
$return_value = |
|
26
|
10
|
|
|
|
|
41
|
$section->{schema}{$schema_key}{transformer}($section->{data}{$key},$section->{data}); |
|
27
|
|
|
|
|
|
|
}; |
|
28
|
10
|
100
|
|
|
|
439
|
if (my $err = $@) { |
|
29
|
2
|
50
|
33
|
|
|
18
|
if (ref $err eq 'HASH' && defined $err->{msg}){ |
|
30
|
2
|
|
|
|
|
4
|
$err = $err->{msg}; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
2
|
|
|
|
|
9
|
return "error transforming '$key': $err"; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
8
|
|
|
|
|
14
|
$section->{data}{$key} = $return_value; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
300
|
|
|
|
|
444
|
return undef; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1 |