Devel-Trepan
view release on metacpan or search on metacpan
lib/Devel/Trepan/CmdProcessor/Command/Info_Subcmd/Variables_Subcmd/My.pm view on Meta::CPAN
# -*- coding: utf-8 -*-
# Copyright (C) 2011-2014 Rocky Bernstein <rocky@cpan.org>
use warnings; no warnings 'redefine'; no warnings 'once';
use rlib '../../../../../..';
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
package Devel::Trepan::CmdProcessor::Command::Info::Variables::My;
use vars qw(@ISA @SUBCMD_VARS);
unless (@ISA) {
eval <<'EOE';
use constant MAX_ARGS => undef;
use constant NEED_STACK => 1;
EOE
}
use strict;
use Devel::Trepan::CmdProcessor::Command::Subcmd::Subsubcmd;
use PadWalker qw(peek_my);
use Devel::Trepan::CmdProcessor::Command::Subcmd::Core;
our $CMD = "info variables my";
my @CMD = split(/ /, $CMD);
=pod
=head2 Synopsis:
=cut
our $MIN_ABBREV = length('m');
our $HELP = <<'HELP';
=pod
B<info variables my>
B<info variables my -v>
B<info variables my> I<var1> [I<var2>...]
Lists C<my> variables at the current frame. Use the frame changing
commands like C<up>, C<down> or C<frame> set the current frame.
In the first form, give a list of C<my> variable names only. In the
second form, list variable names and values In the third form, list
variable names and values of I<var1>, etc.
=head2 See also:
L<C<info variables
lexicals>|Devel::Trepan::CmdProcessor::Command::Info::Variables::Lexicals>,
L<C<info variables
our>|Devel::Trepan::CmdProcessor::Command::Info::Variables::Our>, and
frame-changing commands
=cut
HELP
our $SHORT_HELP = "Information about 'my' variables.";
@ISA = qw(Devel::Trepan::CmdProcessor::Command::Subsubcmd);
sub get_var_hash($;$)
{
my ($self, $fixup_num) = @_;
# FIXME: combine with My.pm
my $i = 0;
while (my ($pkg, $file, $line, $fn) = caller($i++)) { ; };
my $diff = $i - $DB::stack_depth;
# FIXME: 5 is a magic fixup constant, also found in DB::finish.
# Remove it.
$fixup_num = 5 unless defined($fixup_num);
my $ref = peek_my($diff + $self->{proc}{frame_index} + $fixup_num);
return $ref;
}
sub complete($$;$)
{
my ($self, $prefix, $fixup_num) = @_;
# This is really hacky
( run in 3.368 seconds using v1.01-cache-2.11-cpan-5837b0d9d2c )