Next Tricks of the Wizards 88

Function Tracing Again

        sub trace {
          ($package, $file, $line, $subr) = caller;
          my $depth = 0;
          1 while defined caller(++$depth);
          my $indent = "  " x ($depth - 2);
          local $" = ', ';
          print "$package\::$subr(@_)\n";
        }
        sub something {
          ...
        sub something {
          &Trace::trace;
          ...


Next Copyright © 2003 M. J. Dominus