line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer::Plugin::DebugDump; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24645
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
5
|
1
|
|
|
1
|
|
1458
|
use Dancer::Logger; |
|
1
|
|
|
|
|
40179
|
|
|
1
|
|
|
|
|
27
|
|
6
|
1
|
|
|
1
|
|
907
|
use Dancer::Plugin; |
|
1
|
|
|
|
|
108164
|
|
|
1
|
|
|
|
|
171
|
|
7
|
1
|
|
|
1
|
|
1849
|
use Data::Dump; |
|
1
|
|
|
|
|
8974
|
|
|
1
|
|
|
|
|
346
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Dancer::Logger::warning( |
12
|
|
|
|
|
|
|
"Dancer::Plugin::DebugDump is deprecated and may go away in future.\n", |
13
|
|
|
|
|
|
|
"Dancer's built in debug() keyword automatically serialises for you.\n", |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
register debug_dump => sub { |
17
|
0
|
|
|
0
|
|
|
my $message; |
18
|
0
|
0
|
|
|
|
|
if (@_ == 1) { |
|
|
0
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Single thing to dump, easy: |
20
|
0
|
|
|
|
|
|
Dancer::Logger::debug( Data::Dump::dump(shift) ); |
21
|
|
|
|
|
|
|
} elsif (@_ % 2 == 0) { |
22
|
|
|
|
|
|
|
# Looks like we got pairs of labels and dumpable things: |
23
|
0
|
|
|
|
|
|
while (@_) { |
24
|
0
|
|
|
|
|
|
my ($label, $ref) = splice @_, 0, 2; |
25
|
0
|
|
|
|
|
|
Dancer::Logger::debug( "$label: " . Data::Dump::dump($ref) ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} else { |
28
|
|
|
|
|
|
|
# Just feed each argument to dump() and log the result |
29
|
0
|
|
|
|
|
|
Dancer::Logger::debug(Data::Dump::dump($_)) for @_; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
register_plugin; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Dancer::Plugin::DebugDump - dump objects to debug log with Data::Dump [DEPRECATED] |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DEPRECATION NOTICE |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
*NOTE* : this module is now deprecated; there's no need for it, as Dancer's own |
42
|
|
|
|
|
|
|
L automatically serialises any references passed to |
43
|
|
|
|
|
|
|
it using L, so you can just say e.g.: |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
debug \%foo; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
or |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
debug "User details", \%foo; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
This plugin may be removed from CPAN at some point in the future; I've decided |
52
|
|
|
|
|
|
|
to leave it around with a deprecation notice for the time being so that it's |
53
|
|
|
|
|
|
|
still available for anyone already using it. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Provides a C keyword, which takes an optional label and an object |
59
|
|
|
|
|
|
|
or reference to dump, and calls Dancer's C keyword after dumping the |
60
|
|
|
|
|
|
|
object / reference with L. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Allows quick and easy debugging by dumping stuff to your log/console. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SYNOPSIS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
use Dancer::Plugin::DebugDump; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
debug_dump("My nice object" => $object); |
73
|
|
|
|
|
|
|
debug_dump("My hash" => \%hash); |
74
|
|
|
|
|
|
|
debug_dump($anotherref); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHOR |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
David Precious, C<< >> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 BUGS |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
83
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
84
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SUPPORT |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
perldoc Dancer::Plugin::DebugDump |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
You can also look for information at: |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over 4 |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
L |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * CPAN Ratings |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
L |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * Search CPAN |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
L |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=back |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Copyright 2010 David Precious. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
127
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
128
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; # End of Dancer::Plugin::DebugDump |