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
|
|
6
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
53
|
|
23
|
2
|
|
|
2
|
|
5
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
66
|
|
24
|
2
|
|
|
2
|
|
9
|
use base 'Template::Plugin'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
602
|
|
25
|
2
|
|
|
2
|
|
1170
|
use Data::Dumper; |
|
2
|
|
|
|
|
8994
|
|
|
2
|
|
|
|
|
234
|
|
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
|
9
|
my ($class, $context, $params) = @_; |
43
|
7
|
|
|
|
|
5
|
my ($key, $val); |
44
|
7
|
|
100
|
|
|
26
|
$params ||= { }; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
7
|
|
|
|
|
9
|
foreach my $arg (@DUMPER_ARGS) { |
48
|
2
|
|
|
2
|
|
10
|
no strict 'refs'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
371
|
|
49
|
84
|
100
|
100
|
|
|
221
|
if (defined ($val = $params->{ lc $arg }) |
50
|
|
|
|
|
|
|
or defined ($val = $params->{ $arg })) { |
51
|
5
|
|
|
|
|
3
|
${"Data\::Dumper\::$arg"} = $val; |
|
5
|
|
|
|
|
9
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
bless { |
56
|
7
|
|
|
|
|
32
|
_CONTEXT => $context, |
57
|
|
|
|
|
|
|
}, $class; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub dump { |
61
|
4
|
|
|
4
|
1
|
5
|
my $self = shift; |
62
|
4
|
|
|
|
|
9
|
my $content = Dumper @_; |
63
|
4
|
|
|
|
|
189
|
return $content; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub dump_html { |
68
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
69
|
1
|
|
|
|
|
2
|
my $content = Dumper @_; |
70
|
1
|
|
|
|
|
42
|
for ($content) { |
71
|
1
|
|
|
|
|
1
|
s/&/&/g; |
72
|
1
|
|
|
|
|
1
|
s/</g; |
73
|
1
|
|
|
|
|
3
|
s/>/>/g; |
74
|
1
|
|
|
|
|
3
|
s/\n/ \n/g; |
75
|
|
|
|
|
|
|
} |
76
|
1
|
|
|
|
|
4
|
return $content; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |