Devel::Caller::Perl - Perl only implementation.


Devel-Caller-Perl documentation  | view source Contained in the Devel-Caller-Perl distribution.

Index


NAME

Top

Devel::Caller::Perl - Perl only implementation.

SYNOPSIS

Top

 use Devel::Caller::Perl qw[called_args];

 sub permute_args {
   my @args = @_;
   my @caller_args = called_args( 0 );

   my %caller_args =
     map { $_ => $caller_args[$_] } 0 .. $#caller_args;

   return \%caller_args;
 }

 sub dodad {
   my $args = permute_args;

   print $args->{0};
   # ...
 }

ABSTRACT

Top

This module allows a method to get at arguments passed to subroutines higher up in the call stack.

DESCRIPTION

Top

FUNCTIONS

called_args [LEVEL]

called_args returns the arguments to the subroutine at LEVEL in the call stack. If no level is specified, 0 (zero) is assumed, that being our caller. If a list is expected, it will be returned. When a scalar is expected, a list reference will be returned.

If you want the number of arguments passed to the subroutine at LEVEL, there's nothing stopping you from getting it from caller.

 my $number = (caller $level)[4];

AUTHOR

Top

Casey West <casey@geeknest.com>

THANKS

Top

Rocco Caputo -- Much help with code and overall inspiration.

COPYRIGHT

Top

SEE ALSO

Top

perl, Devel::Caller, DB, perldebguts.


Devel-Caller-Perl documentation  | view source Contained in the Devel-Caller-Perl distribution.