line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
|
|
|
|
# Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org> |
3
|
12
|
|
|
12
|
|
84
|
use warnings; no warnings 'redefine'; no warnings 'once'; |
|
12
|
|
|
12
|
|
36
|
|
|
12
|
|
|
12
|
|
443
|
|
|
12
|
|
|
|
|
73
|
|
|
12
|
|
|
|
|
32
|
|
|
12
|
|
|
|
|
364
|
|
|
12
|
|
|
|
|
64
|
|
|
12
|
|
|
|
|
31
|
|
|
12
|
|
|
|
|
297
|
|
4
|
12
|
|
|
12
|
|
65
|
use rlib '../../../../../..'; |
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
87
|
|
5
|
|
|
|
|
|
|
package Devel::Trepan::CmdProcessor::Command::Info::Variables::Our; |
6
|
|
|
|
|
|
|
|
7
|
12
|
|
|
12
|
|
4913
|
use vars qw(@ISA @SUBCMD_VARS); |
|
12
|
|
|
|
|
35
|
|
|
12
|
|
|
|
|
543
|
|
8
|
12
|
|
|
12
|
|
75
|
use strict; |
|
12
|
|
|
|
|
33
|
|
|
12
|
|
|
|
|
295
|
|
9
|
12
|
|
|
12
|
|
74
|
use Devel::Trepan::CmdProcessor::Command::Info_Subcmd::Variables_Subcmd::My; |
|
12
|
|
|
|
|
31
|
|
|
12
|
|
|
|
|
327
|
|
10
|
12
|
|
|
12
|
|
65
|
use PadWalker qw(peek_our); |
|
12
|
|
|
|
|
31
|
|
|
12
|
|
|
|
|
1179
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $CMD = "info variables our"; |
13
|
|
|
|
|
|
|
our @CMD = split(/ /, $CMD); |
14
|
12
|
|
|
12
|
|
84
|
use constant MAX_ARGS => undef; |
|
12
|
|
|
|
|
34
|
|
|
12
|
|
|
|
|
695
|
|
15
|
12
|
|
|
12
|
|
72
|
use constant NEED_STACK => 1; |
|
12
|
|
|
|
|
30
|
|
|
12
|
|
|
|
|
6092
|
|
16
|
|
|
|
|
|
|
=pod |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head2 Synopsis: |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
our $MIN_ABBREV = length('o'); |
22
|
|
|
|
|
|
|
our $HELP = <<'HELP'; |
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
B<info variables our> |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
B<info variables our -v> |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
B<info variables our> I<var1> [I<var2>...] |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
List C<our> variables at the current stack level. Use the |
32
|
|
|
|
|
|
|
frame changing commands like C<up>, C<down> or C<frame> set the |
33
|
|
|
|
|
|
|
current frame. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
In the first form, give a list of C<our> variable names only. |
36
|
|
|
|
|
|
|
In the second form, list variable names and values In the third form, |
37
|
|
|
|
|
|
|
list variable names and values of I<var1>, etc. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 See also: |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
L<C<info variables |
42
|
|
|
|
|
|
|
lexicals>|Devel::Trepan::CmdProcessor::Command::Info::Variables::Lexicals>, |
43
|
|
|
|
|
|
|
L<C<info variables |
44
|
|
|
|
|
|
|
my>|Devel::Trepan::CmdProcessor::Command::Info::Variables::My>, and |
45
|
|
|
|
|
|
|
frame-changing commands |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
HELP |
49
|
|
|
|
|
|
|
our $SHORT_HELP = "Information about 'our' variables."; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
@ISA = qw(Devel::Trepan::CmdProcessor::Command::Info::Variables::My); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub get_var_hash($;$) |
54
|
|
|
|
|
|
|
{ |
55
|
0
|
|
|
0
|
|
|
my ($self, $fixup_num) = @_; |
56
|
|
|
|
|
|
|
# FIXME: combine with My.pm |
57
|
0
|
|
|
|
|
|
my $i = 0; |
58
|
0
|
|
|
|
|
|
while (my ($pkg, $file, $line, $fn) = caller($i++)) { ; }; |
59
|
0
|
|
|
|
|
|
my $diff = $i - $DB::stack_depth; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# FIXME: 5 is a magic fixup constant, also found in DB::finish. |
62
|
|
|
|
|
|
|
# Remove it. |
63
|
0
|
0
|
|
|
|
|
$fixup_num = 5 unless defined($fixup_num); |
64
|
0
|
|
|
|
|
|
peek_our($diff + $self->{proc}{frame_index} + $fixup_num); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
unless (caller) { |
68
|
|
|
|
|
|
|
# Demo it. |
69
|
|
|
|
|
|
|
require Devel::Trepan; |
70
|
|
|
|
|
|
|
my $proc = Devel::Trepan::CmdProcessor->new; |
71
|
|
|
|
|
|
|
my $grandparent = |
72
|
|
|
|
|
|
|
Devel::Trepan::CmdProcessor::Command::Info->new($proc, 'info'); |
73
|
|
|
|
|
|
|
my $parent = |
74
|
|
|
|
|
|
|
Devel::Trepan::CmdProcessor::Command::Info::Variables->new($grandparent, |
75
|
|
|
|
|
|
|
'variables'); |
76
|
|
|
|
|
|
|
my $cmd = __PACKAGE__->new($parent, 'our'); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
eval { |
79
|
|
|
|
|
|
|
sub create_frame() { |
80
|
0
|
|
|
0
|
|
|
my ($pkg, $file, $line, $fn) = caller(0); |
81
|
0
|
|
|
|
|
|
$DB::package = $pkg; |
82
|
|
|
|
|
|
|
return [ |
83
|
|
|
|
|
|
|
{ |
84
|
0
|
|
|
|
|
|
file => $file, |
85
|
|
|
|
|
|
|
fn => $fn, |
86
|
|
|
|
|
|
|
line => $line, |
87
|
|
|
|
|
|
|
pkg => $pkg, |
88
|
|
|
|
|
|
|
}]; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
}; |
91
|
|
|
|
|
|
|
my $frame_ary = create_frame(); |
92
|
|
|
|
|
|
|
$proc->frame_setup($frame_ary); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
$cmd->run($cmd->{prefix}, -2); |
95
|
|
|
|
|
|
|
my @args = @{$cmd->{prefix}}; |
96
|
|
|
|
|
|
|
push @args, '$args'; |
97
|
|
|
|
|
|
|
print '-' x 40, "\n"; |
98
|
|
|
|
|
|
|
push @args, '@CMD'; |
99
|
|
|
|
|
|
|
print '-' x 40, "\n"; |
100
|
|
|
|
|
|
|
$cmd->run(\@args, -2); |
101
|
|
|
|
|
|
|
print '-' x 40, "\n"; |
102
|
|
|
|
|
|
|
$cmd->run($cmd->{prefix}, -1); |
103
|
|
|
|
|
|
|
print '-' x 40, "\n"; |
104
|
|
|
|
|
|
|
my @complete = $cmd->complete('', -1); |
105
|
|
|
|
|
|
|
print join(', ', @complete), "\n"; |
106
|
|
|
|
|
|
|
print '-' x 40, "\n"; |
107
|
|
|
|
|
|
|
@complete = $cmd->complete('$p', -1); |
108
|
|
|
|
|
|
|
print join(', ', @complete), "\n"; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |