tdrgabi has asked for the wisdom of the Perl Monks concerning the following question:

I would like to build some custom debugger, by adding some debugging info on each function call (like name and some params). Write that to a file & write some gui to walk over that file and show the info in a nice way. I'm curious if I can overwrite what happens on function call. Maybe there is some general callback I could use (like overwriting SIG for die & co).
  • Comment on can I get a callback when I call a function

Replies are listed 'Best First'.
Re: can I get a callback when I call a function
by moritz (Cardinal) on Aug 30, 2010 at 15:18 UTC
    The Perl debugger has an API, which you could use for your purposes. See DB for the documentation.

    If there's a reason you can't use that, another common technique is to write your own runloop - but that's probably much more effort.

    Perl 6 - links to (nearly) everything that is Perl 6.
Re: can I get a callback when I call a function
by pemungkah (Priest) on Aug 31, 2010 at 08:13 UTC
    Take a look a Devel::ebug for an example of how a good debugger should look (as opposed to perl5db.pl which is ... arcane).