line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Like::Plugin::Dumper; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
49
|
|
4
|
1
|
|
|
1
|
|
4
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
337
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
#===================================================================== |
7
|
|
|
|
|
|
|
# new |
8
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
9
|
|
|
|
|
|
|
# - API |
10
|
|
|
|
|
|
|
# <% USE Dumper %> |
11
|
|
|
|
|
|
|
# <% Dumper.dump(variable) %> |
12
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
13
|
|
|
|
|
|
|
# - args |
14
|
|
|
|
|
|
|
# $params ... PARAMS ( HASHREF ) |
15
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
16
|
|
|
|
|
|
|
# - returns |
17
|
|
|
|
|
|
|
# Template::Like::Plugin::Dumper Object. |
18
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
19
|
|
|
|
|
|
|
# - Example |
20
|
|
|
|
|
|
|
# <% USE Dumper(indent=4) %> |
21
|
|
|
|
|
|
|
# <% Dumper.dump(variable) %> |
22
|
|
|
|
|
|
|
#===================================================================== |
23
|
|
|
|
|
|
|
sub new { |
24
|
5
|
|
|
5
|
0
|
6
|
my $class = shift; |
25
|
5
|
|
|
|
|
6
|
my $context = shift; |
26
|
5
|
50
|
|
|
|
14
|
my $params = ref $_[0] ? $_[0] : {@_}; |
27
|
|
|
|
|
|
|
|
28
|
5
|
|
|
|
|
18
|
my $dumper = Data::Dumper->new([]); |
29
|
|
|
|
|
|
|
|
30
|
5
|
|
|
|
|
108
|
for my $key ( keys %{ $params } ) { |
|
5
|
|
|
|
|
14
|
|
31
|
2
|
|
|
|
|
5
|
my $method = ucfirst( $key ); |
32
|
2
|
50
|
|
|
|
13
|
if ($dumper->can($method)) { |
33
|
2
|
|
|
|
|
8
|
$dumper->$method( $params->{ $key } ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
5
|
|
|
|
|
46
|
return bless { _CONTEXT => $context, dumper => $dumper }, $class; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#===================================================================== |
43
|
|
|
|
|
|
|
# dump |
44
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
45
|
|
|
|
|
|
|
# - API |
46
|
|
|
|
|
|
|
# |
47
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
48
|
|
|
|
|
|
|
# - args |
49
|
|
|
|
|
|
|
# |
50
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
51
|
|
|
|
|
|
|
# - returns |
52
|
|
|
|
|
|
|
# |
53
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
54
|
|
|
|
|
|
|
# - Example |
55
|
|
|
|
|
|
|
# <% Dumper.dump(variable) %> |
56
|
|
|
|
|
|
|
#===================================================================== |
57
|
|
|
|
|
|
|
sub dump { |
58
|
5
|
|
|
5
|
0
|
6
|
my $self = shift; |
59
|
|
|
|
|
|
|
|
60
|
5
|
|
|
|
|
10
|
$self->dumper->Reset; |
61
|
5
|
|
|
|
|
32
|
$self->dumper->Values(\@_); |
62
|
|
|
|
|
|
|
|
63
|
5
|
|
|
|
|
39
|
my $data = $self->dumper->Dump(@_); |
64
|
|
|
|
|
|
|
|
65
|
5
|
|
|
|
|
114
|
return $data; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
#===================================================================== |
69
|
|
|
|
|
|
|
# dump_html |
70
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
71
|
|
|
|
|
|
|
# - API |
72
|
|
|
|
|
|
|
# |
73
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
74
|
|
|
|
|
|
|
# - args |
75
|
|
|
|
|
|
|
# |
76
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
77
|
|
|
|
|
|
|
# - returns |
78
|
|
|
|
|
|
|
# |
79
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
80
|
|
|
|
|
|
|
# - Example |
81
|
|
|
|
|
|
|
# <% Dumper.dump_html(variable) %> |
82
|
|
|
|
|
|
|
#===================================================================== |
83
|
|
|
|
|
|
|
sub dump_html { |
84
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
85
|
|
|
|
|
|
|
|
86
|
1
|
|
|
|
|
3
|
my $data = $self->dump(@_); |
87
|
|
|
|
|
|
|
|
88
|
1
|
|
|
|
|
13
|
return $self->{'_CONTEXT'}->filter('html_line_break', |
89
|
|
|
|
|
|
|
$self->{'_CONTEXT'}->filter('html', $data) |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
#===================================================================== |
94
|
|
|
|
|
|
|
# Data::Dumper Object |
95
|
|
|
|
|
|
|
#===================================================================== |
96
|
15
|
|
|
15
|
0
|
56
|
sub dumper { shift->{'dumper'} } |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |