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
|
|
14
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
87
|
|
23
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
73
|
|
24
|
2
|
|
|
2
|
|
13
|
use base 'Template::Plugin'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1610
|
|
25
|
2
|
|
|
2
|
|
2440
|
use Data::Dumper; |
|
2
|
|
|
|
|
14447
|
|
|
2
|
|
|
|
|
364
|
|
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
|
|
|
|
|
15
|
my ($key, $val); |
44
|
7
|
|
100
|
|
|
33
|
$params ||= { }; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
7
|
|
|
|
|
15
|
foreach my $arg (@DUMPER_ARGS) { |
48
|
2
|
|
|
2
|
|
19
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
523
|
|
49
|
84
|
100
|
100
|
|
|
454
|
if (defined ($val = $params->{ lc $arg }) |
50
|
|
|
|
|
|
|
or defined ($val = $params->{ $arg })) { |
51
|
5
|
|
|
|
|
5
|
${"Data\::Dumper\::$arg"} = $val; |
|
5
|
|
|
|
|
26
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
bless { |
56
|
7
|
|
|
|
|
75
|
_CONTEXT => $context, |
57
|
|
|
|
|
|
|
}, $class; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub dump { |
61
|
4
|
|
|
4
|
1
|
10
|
my $self = shift; |
62
|
4
|
|
|
|
|
21
|
my $content = Dumper @_; |
63
|
4
|
|
|
|
|
385
|
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
|
|
|
|
|
80
|
for ($content) { |
71
|
1
|
|
|
|
|
5
|
s/&/&/g; |
72
|
1
|
|
|
|
|
2
|
s/</g; |
73
|
1
|
|
|
|
|
6
|
s/>/>/g; |
74
|
1
|
|
|
|
|
7
|
s/\n/ \n/g; |
75
|
|
|
|
|
|
|
} |
76
|
1
|
|
|
|
|
6
|
return $content; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |