Next Tricks of the Wizards 186

Trace Execution

        package Devel::Trace;
        sub DB::DB {
          my ($p, $f, $l) = caller;
          my $code = \@{"::_<$f"};
          print STDERR ">> $f($l) $code->[$l]";
        }
        >> sample.pl(1) for (1 .. ($ARGV[0] || 12)) {
        >> sample.pl(2)   next unless $_ % 12;
        >> sample.pl(3)   print "";
        >> sample.pl(1) for (1 .. ($ARGV[0] || 12)) {
        (etc.)


Next Copyright © 2003 M. J. Dominus