Devel-Chitin
view release on metacpan or search on metacpan
"runtime" : {
"requires" : {
"B" : "0",
"Carp" : "0",
"Devel::Callsite" : "0",
"Digest::MD5" : "0",
"Exporter" : "0",
"Fcntl" : "0",
"IO::File" : "0",
"POSIX" : "0",
"PadWalker" : "0",
"Scalar::Util" : "0",
"Socket" : "0",
"base" : "0",
"constant" : "0",
"perl" : "5.008009",
"strict" : "0",
"warnings" : "0"
}
},
"test" : {
name: Devel-Chitin
requires:
B: '0'
Carp: '0'
Devel::Callsite: '0'
Digest::MD5: '0'
Exporter: '0'
Fcntl: '0'
IO::File: '0'
POSIX: '0'
PadWalker: '0'
Scalar::Util: '0'
Socket: '0'
base: '0'
constant: '0'
perl: '5.008009'
strict: '0'
warnings: '0'
resources:
repository: https://github.com/brummett/Devel-Chitin.git
version: '0.22'
Makefile.PL view on Meta::CPAN
"NAME" => "Devel::Chitin",
"PREREQ_PM" => {
"B" => 0,
"Carp" => 0,
"Devel::Callsite" => 0,
"Digest::MD5" => 0,
"Exporter" => 0,
"Fcntl" => 0,
"IO::File" => 0,
"POSIX" => 0,
"PadWalker" => 0,
"Scalar::Util" => 0,
"Socket" => 0,
"base" => 0,
"constant" => 0,
"strict" => 0,
"warnings" => 0
},
"TEST_REQUIRES" => {
"File::Basename" => 0,
"List::Util" => "1.45",
Makefile.PL view on Meta::CPAN
"B" => 0,
"Carp" => 0,
"Devel::Callsite" => 0,
"Digest::MD5" => 0,
"Exporter" => 0,
"Fcntl" => 0,
"File::Basename" => 0,
"IO::File" => 0,
"List::Util" => "1.45",
"POSIX" => 0,
"PadWalker" => 0,
"Scalar::Util" => 0,
"Socket" => 0,
"Sub::Name" => 0,
"Test2::API" => "1.302136",
"Test2::IPC" => 0,
"Test2::Require::Fork" => 0,
"Test2::Tools::Basic" => 0,
"Test2::Tools::Subtest" => 0,
"Test2::V0" => 0,
"Test::Builder" => 0,
lib/Devel/Chitin.pm view on Meta::CPAN
be an arrayref.
=item CLIENT->eval_at($string [, $level]);
Evaluate the given string in the context of the program being debugged. If
$level is omitted, the string is run in the context of the most recent stack
frame of the debugged program. Otherwise, $level is the number of stack
frames before the most recent to evaluate the code in. Negative numbers are
treated as 0. eval_at returns a list of two items, the result and exception.
This method requires the PadWalker module.
This method is not yet implemented.
=item CLIENT->get_var_at_level($string, $level);
Return the value of the given variable expression. $level is the stack level
in the context of the debugged program; 0 is the most recent level. $string
is the name of the variable to inspect, including the sigil. This method
handles some more complicated expressions such array and hash elements and
slices.
lib/Devel/Chitin/GetVarAtLevel.pm view on Meta::CPAN
} else {
return $value;
}
}
sub get_var_at_level {
my($varname, $level) = @_;
return if ($level < 0); # reject inspection into our frame
require PadWalker;
my($first_program_frame_pw, $first_program_frame) = _first_program_frame();
if ($varname !~ m/^[\$\@\%\*]/) {
# not a variable at all, just return it
return $varname;
} elsif ($varname eq '@_' or $varname eq '@ARG') {
# handle these special, they're implemented as local() vars, so we'd
# really need to eval at some higher stack frame to inspect it if we could
# (that would make this whole enterprise easier). We can fake it by using
# caller's side effect
# Count how many eval frames are between here and there.
# caller() counts them, but PadWalker does not
{
package DB;
no warnings 'void';
(caller($level + $first_program_frame))[3];
}
my @args = @DB::args;
return \@args;
} elsif ($varname =~ m/\[|\}/) {
# Not a simple variable name, maybe a complicated expression
# like @list[1,2,3]. Try to emulate something like eval_at_level()
return evaluate_complex_var_at_level($varname, $level);
}
my $h = eval { PadWalker::peek_my( ($level + $first_program_frame_pw) || 1); };
unless (exists $h->{$varname}) {
# not a lexical, try our()
$h = PadWalker::peek_our( ($level + $first_program_frame_pw) || 1);
}
if (exists $h->{$varname}) {
# it's a simple varname, padwalker found it
if (ref($h->{$varname}) eq 'SCALAR' or ref($h->{$varname}) eq 'REF' or ref($h->{$varname}) eq 'VSTRING') {
return ${ $h->{$varname} };
} else {
return $h->{$varname};
}
lib/Devel/Chitin/GetVarAtLevel.pm view on Meta::CPAN
if (@$list < 2) {
return $list->[0];
} elsif ($sigil eq '%') {
my %hash = @$list;
return \%hash;
} else {
return $list;
}
}
# How many frames between here and the program, both for PadWalker (which
# doesn't count eval frames) and caller (which does)
sub _first_program_frame {
my $evals = 0;
for(my $level = 1;
my ($package, $filename, $line, $subroutine) = caller($level);
$level++
) {
if ($subroutine eq 'DB::DB') {
return ($level - $evals, $level - 1); # -1 to skip this frame
} elsif ($subroutine eq '(eval)') {
( run in 0.838 second using v1.01-cache-2.11-cpan-05444aca049 )