line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Dumpvalue; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
32733
|
use base qw(Template::Plugin); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1377
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
9675
|
use Dumpvalue; |
|
1
|
|
|
|
|
6992
|
|
|
1
|
|
|
|
|
306
|
|
6
|
1
|
|
|
1
|
|
1416
|
use IO::Scalar; |
|
1
|
|
|
|
|
27209
|
|
|
1
|
|
|
|
|
53
|
|
7
|
1
|
|
|
1
|
|
10
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
986
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 1.01; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
13
|
0
|
|
|
|
|
|
my $context = shift; |
14
|
0
|
|
|
|
|
|
my $hash = shift; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $d = Dumpvalue->new(); |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $self = { |
19
|
|
|
|
|
|
|
d => $d, |
20
|
|
|
|
|
|
|
stash => $context->{STASH}, |
21
|
|
|
|
|
|
|
output => '', |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
bless $self, $class; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
$self->set($hash); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub dump_template_vars { |
32
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return $self->dumpValue($self->{stash}); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub grab_output { |
38
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
39
|
0
|
|
|
|
|
|
my $code = shift; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $output; |
43
|
0
|
|
|
|
|
|
tie *DUMP, 'IO::Scalar', \$output; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my $old_fh = select(DUMP); |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
&{$code}; |
|
0
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
select($old_fh); |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
if($self->{inHTML}) { |
52
|
0
|
|
|
|
|
|
$output =~ s/</g; |
53
|
0
|
|
|
|
|
|
$output =~ s/>/>/g; |
54
|
0
|
|
|
|
|
|
$output = "$output "; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return $output; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub dumpValue { |
61
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
62
|
0
|
|
|
|
|
|
my $dump = shift; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
return $self->grab_output( sub { |
65
|
0
|
|
|
0
|
|
|
$self->{d}->dumpValue(\$dump); |
66
|
0
|
|
|
|
|
|
}); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub dumpValues { |
70
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
71
|
0
|
|
|
|
|
|
my @values = @_; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
return $self->dumpValue(\@values); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub dumpvars { |
77
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
78
|
0
|
|
|
|
|
|
my @args = @_; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
return $self->grab_output( sub { |
81
|
0
|
|
|
0
|
|
|
$self->{d}->dumpvars(@args); |
82
|
0
|
|
|
|
|
|
}); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub set { |
86
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
87
|
0
|
|
|
|
|
|
my $hash = shift; |
88
|
|
|
|
|
|
|
|
89
|
0
|
0
|
|
|
|
|
if(exists($hash->{inHTML})) { |
90
|
0
|
|
|
|
|
|
$self->{inHTML} = delete $hash->{inHTML}; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
$self->{d}->set(%$hash); |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
return ''; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub get { |
99
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
100
|
0
|
|
|
|
|
|
my @array = @_; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
my @values = $self->{d}->get(@array); |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
return @values; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub stringify { |
108
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
return $self->{d}->stringify(@_); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub compactDump { |
114
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
$self->{d}->compactDump(@_); |
117
|
0
|
|
|
|
|
|
return; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub veryCompact { |
121
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
$self->{d}->veryCompact(@_); |
124
|
0
|
|
|
|
|
|
return; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub set_quote { |
128
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
$self->{d}->set_quote(@_); |
131
|
0
|
|
|
|
|
|
return; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub set_unctrl { |
135
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
$self->{d}->set_unctrl(@_); |
138
|
0
|
|
|
|
|
|
return; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
1; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
__END__ |