I love Smart::Comments! Basically, it requires you to write debug comments like this:
sub foo {
### entering foo
my $x = shift;
### x: $x
return $x + 1;
}
### starting...
my $y = foo(42);
### y: $y
### finish
exit;
As you can see, they're just simple comments, until you use Smart::Comments, when they'll magically print the following output to STDERR:
### starting...
### entering foo
### x: 42
### y: 43
### finish
The best part is that, when you disable Smart::Comments, they will sit quietly there -- just like comments they are -- documenting your code, but not being executed.
Simple, useful... smart!!! :)