1Devel::Caller(3)      User Contributed Perl Documentation     Devel::Caller(3)
2
3
4

NAME

6       Devel::Caller - meatier versions of "caller"
7

SYNOPSIS

9        use Devel::Caller qw(caller_cv);
10        $foo = sub { print "huzzah\n" if $foo == caller_cv(0) };
11        $foo->();  # prints huzzah
12
13        use Devel::Caller qw(called_with);
14        sub foo { print called_with(0,1); }
15        foo( my @foo ); # should print '@foo'
16

DESCRIPTION

18       caller_cv($level)
19           "caller_cv" gives you the coderef of the subroutine being invoked
20           at the call frame indicated by the value of $level
21
22       caller_args($level)
23           Returns the arguments passed into the caller at level $level
24
25       caller_vars( $level, $names ) =item called_with($level, $names)
26           "called_with" returns a list of references to the original
27           arguments to the subroutine at $level.  if $names is true, the
28           names of the variables will be returned instead
29
30           constants are returned as "undef" in both cases
31
32       called_as_method($level)
33           "called_as_method" returns true if the subroutine at $level was
34           called as a method.
35

BUGS

37       All of these routines are susceptible to the same limitations as
38       "caller" as described in "caller" in perlfunc
39
40       The deparsing of the optree perfomed by called_with is fairly simple-
41       minded and so a bit flaky.
42
43       •   As a version 2.0 of Devel::Caller we no longer maintain
44           compatibility with versions of perl earlier than 5.8.2.  Older
45           versions continue to be available from CPAN and backpan.
46

SEE ALSO

48       "caller" in perlfunc, PadWalker, Devel::Peek
49

AUTHOR

51       Richard Clamp <richardc@unixbeard.net> with close reference to
52       PadWalker by Robin Houston
53
55       Copyright (c) 2002, 2003, 2006, 2007, 2008, 2010, 2013 Richard Clamp.
56       All Rights Reserved.
57
58       This module is free software. It may be used, redistributed and/or
59       modified under the same terms as Perl itself.
60
61
62
63perl v5.36.0                      2022-07-22                  Devel::Caller(3)
Impressum