I'm not saying never put in debug prints and prefer the debugger instead--I prefer prints myself--but it's useful to distinguish prints you put in for fixing a particular problem at hand, which are usually temporary and removed after the problem is resolved, and logging messages, which are usually permanent even if easily turned off.
For the latter, there are many elaborate logging packages on CPAN, such as Log::Dispatch and Log::Log4perl to name two. For the former, where both informativeness and easy removal are important I usually use these subs which I stick in some common module:
(It used to be ::D and ::DD using Data::Dumper instead of YAML::Syck, but I often end up installing the non-core Y::S on systems I use anyway, and I like its output better.)sub ::Y { require YAML::Syck; YAML::Syck::Dump(@_) } sub ::YY { require Carp; Carp::confess(::Y(@_)) }
In reply to Re: Using the Perl Debugger (-d)
by gaal
in thread Using the Perl Debugger (-d)
by Melly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |