line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#============================================================================== |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Template::Plugin::Dumper |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# DESCRIPTION |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# A Template Plugin to provide a Template Interface to Data::Dumper |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# AUTHOR |
10
|
|
|
|
|
|
|
# Simon Matthews |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# COPYRIGHT |
13
|
|
|
|
|
|
|
# Copyright (C) 2000 Simon Matthews. All Rights Reserved |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# This module is free software; you can redistribute it and/or |
16
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
#============================================================================== |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package Template::Plugin::Dumper; |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
79
|
|
23
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
77
|
|
24
|
2
|
|
|
2
|
|
11
|
use base 'Template::Plugin'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1024
|
|
25
|
2
|
|
|
2
|
|
2406
|
use Data::Dumper; |
|
2
|
|
|
|
|
14119
|
|
|
2
|
|
|
|
|
430
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $VERSION = 2.70; |
28
|
|
|
|
|
|
|
our $DEBUG = 0 unless defined $DEBUG; |
29
|
|
|
|
|
|
|
our @DUMPER_ARGS = qw( Indent Pad Varname Purity Useqq Terse Freezer |
30
|
|
|
|
|
|
|
Toaster Deepcopy Quotekeys Bless Maxdepth ); |
31
|
|
|
|
|
|
|
our $AUTOLOAD; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#============================================================================== |
34
|
|
|
|
|
|
|
# ----- CLASS METHODS ----- |
35
|
|
|
|
|
|
|
#============================================================================== |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
38
|
|
|
|
|
|
|
# new($context, \@params) |
39
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new { |
42
|
7
|
|
|
7
|
1
|
18
|
my ($class, $context, $params) = @_; |
43
|
7
|
|
|
|
|
13
|
my ($key, $val); |
44
|
7
|
|
100
|
|
|
35
|
$params ||= { }; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
7
|
|
|
|
|
20
|
foreach my $arg (@DUMPER_ARGS) { |
48
|
2
|
|
|
2
|
|
27
|
no strict 'refs'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
547
|
|
49
|
84
|
100
|
100
|
|
|
361
|
if (defined ($val = $params->{ lc $arg }) |
50
|
|
|
|
|
|
|
or defined ($val = $params->{ $arg })) { |
51
|
5
|
|
|
|
|
6
|
${"Data\::Dumper\::$arg"} = $val; |
|
5
|
|
|
|
|
25
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
bless { |
56
|
7
|
|
|
|
|
68
|
_CONTEXT => $context, |
57
|
|
|
|
|
|
|
}, $class; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub dump { |
61
|
4
|
|
|
4
|
1
|
12
|
my $self = shift; |
62
|
4
|
|
|
|
|
22
|
my $content = Dumper @_; |
63
|
4
|
|
|
|
|
430
|
return $content; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub dump_html { |
68
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
69
|
1
|
|
|
|
|
7
|
my $content = Dumper @_; |
70
|
1
|
|
|
|
|
107
|
for ($content) { |
71
|
1
|
|
|
|
|
3
|
s/&/&/g; |
72
|
1
|
|
|
|
|
2
|
s/</g; |
73
|
1
|
|
|
|
|
5
|
s/>/>/g; |
74
|
1
|
|
|
|
|
6
|
s/\n/ \n/g; |
75
|
|
|
|
|
|
|
} |
76
|
1
|
|
|
|
|
6
|
return $content; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |