Take me over?
The maintainer of this distribution is looking for someone to take over!
If you're interested then please contact them via
email.
NAME
Devel::STDERR::Indent - Indents STDERR to aid in print-debugging recursive algorithms.
SYNOPSIS
use Devel::STDERR::Indent qw/indent/;
sub factorial {
my $h = indent; # debugging aid
my $n = shift;
warn "computing factorial $n"; # indented
if ($n == 0) {
return 1
} else {
my $got = factorial($n - 1);
warn "got back $got, multiplying by $n";
return $n * $got;
}
}
DESCRIPTION
When debugging recursive code it's useful, but often too much trouble to have your traces indented.
This module makes it easy - call the indent function, and keep the thing you got back around until the sub exits.
This will wrap $SIG{__WARN__} with something that adds one level of indentation to strings (c<s/^/\t/g>) and then delegates to the previous $SIG{__WARN__} handler.
When the handle is destroyed (due to garbage collection), the wrapping is undone.