| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DB::Pluggable::Dumper; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
25951
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
41
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
5
|
1
|
|
|
1
|
|
30
|
use 5.008; |
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
38
|
|
|
6
|
1
|
|
|
1
|
|
1213
|
use Data::Dumper (); |
|
|
1
|
|
|
|
|
14462
|
|
|
|
1
|
|
|
|
|
65
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
915
|
use parent 'DB::Pluggable::Plugin'; |
|
|
1
|
|
|
|
|
339
|
|
|
|
1
|
|
|
|
|
5
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $eval = \&DB::eval; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub register { |
|
13
|
|
|
|
|
|
|
my ( $self, $context ) = @_; |
|
14
|
|
|
|
|
|
|
$self->make_command( xx => sub { }, ); |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# XXX I couldn't make this work by pushing the eval override into |
|
18
|
|
|
|
|
|
|
# DB::Pluggable :( |
|
19
|
|
|
|
|
|
|
{ |
|
20
|
|
|
|
|
|
|
package # hide from pause |
|
21
|
|
|
|
|
|
|
DB; |
|
22
|
|
|
|
|
|
|
*eval = sub { |
|
23
|
|
|
|
|
|
|
if ( $DB::evalarg =~ s/\n\s*xx\s+([^\n]+)$/\n $1/ ) { |
|
24
|
|
|
|
|
|
|
no warnings 'redefine'; |
|
25
|
|
|
|
|
|
|
local $DB::onetimeDump = 'dump'; # main::dumpvar shows the output |
|
26
|
|
|
|
|
|
|
local *DB::dumpit = sub { |
|
27
|
|
|
|
|
|
|
my ( $fh, $res ) = @_; |
|
28
|
|
|
|
|
|
|
my $dd = Data::Dumper->new( [] ); |
|
29
|
|
|
|
|
|
|
$dd->Terse(1)->Indent(1)->Useqq(1)->Deparse(1)->Quotekeys(0) |
|
30
|
|
|
|
|
|
|
->Sortkeys(1); |
|
31
|
|
|
|
|
|
|
print $fh $dd->Values($res)->Dump; |
|
32
|
|
|
|
|
|
|
}; |
|
33
|
|
|
|
|
|
|
$eval->(); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
else { |
|
36
|
|
|
|
|
|
|
$eval->(); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
}; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
DB::Pluggable::Dumper - Add 'xx' dumper to debugger |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 VERSION |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Version 0.01 |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
In your C<$HOME/.perldb>: |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
#!/usr/bin/env perl |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
use DB::Pluggable; |
|
62
|
|
|
|
|
|
|
use YAML; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
$DB::PluginHandler = DB::Pluggable->new( config => Load <<'END'); |
|
65
|
|
|
|
|
|
|
global: |
|
66
|
|
|
|
|
|
|
log: |
|
67
|
|
|
|
|
|
|
level: error |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
plugins: |
|
70
|
|
|
|
|
|
|
- module: Dumper |
|
71
|
|
|
|
|
|
|
END |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
$DB::PluginHandler->run; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This module adds the C command to the debugger. It's like the C |
|
78
|
|
|
|
|
|
|
command, but outputs pretty L format. Here's the output of a |
|
79
|
|
|
|
|
|
|
data structure with 'x': |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
auto(-2) DB<2> x $before |
|
82
|
|
|
|
|
|
|
0 HASH(0x100e7e8f0) |
|
83
|
|
|
|
|
|
|
'aref' => ARRAY(0x1009000d8) |
|
84
|
|
|
|
|
|
|
0 1 |
|
85
|
|
|
|
|
|
|
1 2 |
|
86
|
|
|
|
|
|
|
2 4 |
|
87
|
|
|
|
|
|
|
'guess' => CODE(0x100829568) |
|
88
|
|
|
|
|
|
|
-> &main::testit in run.pl:3-6 |
|
89
|
|
|
|
|
|
|
'uno' => HASH(0x100803108) |
|
90
|
|
|
|
|
|
|
'this' => 'that' |
|
91
|
|
|
|
|
|
|
'what?' => HASH(0x100e3d508) |
|
92
|
|
|
|
|
|
|
'this' => 'them' |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Here's the same data structure with 'xx': |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
auto(-1) DB<3> xx $after |
|
97
|
|
|
|
|
|
|
{ |
|
98
|
|
|
|
|
|
|
aref => [ |
|
99
|
|
|
|
|
|
|
1, |
|
100
|
|
|
|
|
|
|
2, |
|
101
|
|
|
|
|
|
|
4 |
|
102
|
|
|
|
|
|
|
], |
|
103
|
|
|
|
|
|
|
guess => sub { |
|
104
|
|
|
|
|
|
|
my $x = shift @_; |
|
105
|
|
|
|
|
|
|
return $x + 1; |
|
106
|
|
|
|
|
|
|
}, |
|
107
|
|
|
|
|
|
|
uno => { |
|
108
|
|
|
|
|
|
|
this => "that", |
|
109
|
|
|
|
|
|
|
"what?" => { |
|
110
|
|
|
|
|
|
|
this => "them" |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Which would you rather debug? |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 TODO |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=over 4 |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item * Add support for L. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * Push the eval hack back into L. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item * Allow control over dumper configuration. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=back |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=over 4 |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item * L |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Marcel GrĂ¼nauer wrote this to add plugin support to the Perl debugger. Has |
|
136
|
|
|
|
|
|
|
L and L included. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item * L |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Adds a 'C | ' command to the debugger. Opens up a strack trace in your
|
|
141
|
|
|
|
|
|
|
browswer, complete with lexicals. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 NOTE |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This code is an awful hack because the perl debugger (C) is an |
|
146
|
|
|
|
|
|
|
awful hack. My apologies. |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=back |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 AUTHOR |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Curtis "Ovid" Poe, C<< >> |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 BUGS |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Please report any bugs or feature requests to C
|
|
157
|
|
|
|
|
|
|
rt.cpan.org>, or through the web interface at |
|
158
|
|
|
|
|
|
|
L. I will |
|
159
|
|
|
|
|
|
|
be notified, and then you'll automatically be notified of progress on your bug |
|
160
|
|
|
|
|
|
|
as I make changes. |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 SUPPORT |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
perldoc DB::Pluggable::Dumper |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
You can also look for information at: |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=over 4 |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
L |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
L |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
L |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * Search CPAN |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
L |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=back |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=over 4 |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item * Marcel GrĂ¼nauer (for L) |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item * Matt Trout (for L) |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item * Vienna.pm, for sponsoring the 2010 Perl QA Hackathon |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=back |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Copyright 2010 Curtis "Ovid" Poe, all rights reserved. |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
207
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=cut |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
1; # End of DB::Pluggable::Dumper |