in reply to Re: Get first caller and its arguments
in thread Get first caller and its arguments

The main problem is that i can't get caller args with caller(). Am i wrong?
  • Comment on Re^2: Get first caller and its arguments

Replies are listed 'Best First'.
Re^3: Get first caller and its arguments
by runrig (Abbot) on Sep 12, 2011 at 16:59 UTC
    In the caller docs, did you read this:
    Furthermore, when called from within the DB package, caller returns more detailed information: it sets the list variable @DB::args to be the arguments with which the subroutine was invoked.
    Also look (and/or use) Devel::Caller::Perl (which uses the "called within the DB package" technique) or Devel::Caller.
      did you read this
      Yes, but it says i can use it only in the debugger, not in my script. However i can miss smth, because i am not familar with Perl debugger.
      Also look (and/or use) Devel::Caller::Perl
      Thanks, this works.
        ...it says i can use it only in the debugger

        No, that's not what it says. Look at the source for Devel::Caller::Perl, and that might give you an idea of what it really says.

      It seems I understood "called with the DB package" technique
      package DB; use Data::Dumper; sub a { b() } sub b { c() } sub c { my @a = caller(2); print Dumper \@a; print Dumper \@DB::args; } a("test", [1,2,3]);