line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
85875
|
use strict; use warnings; |
|
2
|
|
|
2
|
|
5
|
|
|
2
|
|
|
|
|
85
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
140
|
|
2
|
|
|
|
|
|
|
package Template::Plugin::YAMLVal; |
3
|
|
|
|
|
|
|
our $VERSION = '0.15'; |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
29
|
use base 'Template::Plugin'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1920
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
8003
|
use Template::Toolkit::Simple; |
|
2
|
|
|
|
|
58547
|
|
|
2
|
|
|
|
|
124
|
|
8
|
2
|
|
|
2
|
|
1577
|
use YAML(); |
|
2
|
|
|
|
|
23371
|
|
|
2
|
|
|
|
|
51
|
|
9
|
2
|
|
|
2
|
|
21
|
use YAML::XS(); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
539
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
1
|
|
|
1
|
1
|
57
|
my ($class, $context) = @_; |
13
|
1
|
|
|
|
|
6
|
my $self = bless {}, $class; |
14
|
|
|
|
|
|
|
$context->define_vmethod( |
15
|
|
|
|
|
|
|
$_ => yamlval => sub { |
16
|
9
|
|
|
9
|
|
243
|
$self->yamlval(@_) |
17
|
|
|
|
|
|
|
} |
18
|
1
|
|
|
|
|
11
|
) for qw[hash list scalar]; |
19
|
1
|
|
|
|
|
83
|
return $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub yamlval { |
23
|
9
|
|
|
9
|
0
|
17
|
my ($self, $value) = @_; |
24
|
9
|
100
|
|
|
|
26
|
my $dumper = ref($value) |
25
|
|
|
|
|
|
|
? \&YAML::XS::Dump |
26
|
|
|
|
|
|
|
: \&YAML::Dump; |
27
|
9
|
|
|
|
|
323
|
my $dump = &$dumper({ fakekey => $value }); |
28
|
9
|
|
|
|
|
20357
|
$dump =~ s/^.*?fakekey://s; |
29
|
9
|
|
|
|
|
26
|
$dump =~ s/^ //s; |
30
|
9
|
|
|
|
|
14
|
chomp $dump; |
31
|
9
|
|
|
|
|
44
|
return $dump; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |