in reply to Using the Perl Debugger (-d)
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(@_)) }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using the Perl Debugger (-d)
by sgifford (Prior) on Jan 25, 2007 at 17:23 UTC | |
by MaxKlokan (Monk) on Jan 26, 2007 at 10:33 UTC | |
by bart (Canon) on Jan 26, 2007 at 11:59 UTC | |
by BrowserUk (Patriarch) on Jan 26, 2007 at 12:09 UTC | |
|
Re^2: Using the Perl Debugger (-d)
by sgt (Deacon) on Jan 25, 2007 at 18:32 UTC | |
by BerntB (Deacon) on Jan 25, 2007 at 18:36 UTC | |
by gaal (Parson) on Jan 25, 2007 at 18:39 UTC | |
by nferraz (Monk) on Jan 26, 2007 at 17:12 UTC | |
by djp (Hermit) on Jan 29, 2007 at 02:54 UTC |