in reply to Get first caller and its arguments

Have you looked at caller? In what ways does it fail to do what you want?

Replies are listed 'Best First'.
Re^2: Get first caller and its arguments
by OlegG (Monk) on Sep 12, 2011 at 16:46 UTC
    The main problem is that i can't get caller args with caller(). Am i wrong?
      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 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]);