line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package YAML::Conditional; |
2
|
14
|
|
|
14
|
|
981211
|
use 5.006; use strict; use warnings; our $VERSION = '0.02'; |
|
14
|
|
|
14
|
|
173
|
|
|
14
|
|
|
14
|
|
80
|
|
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
329
|
|
|
14
|
|
|
|
|
87
|
|
|
14
|
|
|
|
|
44
|
|
|
14
|
|
|
|
|
729
|
|
3
|
14
|
|
|
14
|
|
6606
|
use YAML::XS qw/Dump DumpFile Load LoadFile/; use base 'Struct::Conditional'; |
|
14
|
|
|
14
|
|
41207
|
|
|
14
|
|
|
|
|
914
|
|
|
14
|
|
|
|
|
104
|
|
|
14
|
|
|
|
|
30
|
|
|
14
|
|
|
|
|
7053
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub encode { |
6
|
0
|
|
|
0
|
1
|
0
|
Dump($_[1]); |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub encode_file { |
10
|
0
|
|
|
0
|
0
|
0
|
DumpFile($_[1], $_[2]); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub decode { |
14
|
15
|
50
|
33
|
15
|
1
|
96
|
if ($_[1] !~ m/\n/ && -f $_[1]) { |
15
|
0
|
|
|
|
|
0
|
$_[0]->decode_file($_[1]); |
16
|
|
|
|
|
|
|
} |
17
|
15
|
|
|
|
|
1638
|
Load($_[1]); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub decode_file { |
21
|
0
|
|
|
0
|
1
|
0
|
LoadFile($_[1], $_[2]); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub compile { |
25
|
15
|
|
|
15
|
1
|
3129
|
my ($self, $yaml, $params, $return_struct, $out_file) = @_; |
26
|
15
|
50
|
|
|
|
94
|
$yaml = $self->decode($yaml) unless ref $yaml; |
27
|
15
|
50
|
|
|
|
118
|
$params = $self->decode($params) unless ref $params; |
28
|
15
|
|
|
|
|
147
|
$yaml = $self->SUPER::compile($yaml, $params); |
29
|
15
|
0
|
|
|
|
10218
|
return $return_struct |
|
|
50
|
|
|
|
|
|
30
|
|
|
|
|
|
|
? $yaml |
31
|
|
|
|
|
|
|
: $out_file |
32
|
|
|
|
|
|
|
? $self->encode_file($out_file, $yaml) |
33
|
|
|
|
|
|
|
: $self->encode($yaml); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |