[ABE.pm] printing status messages
Ricardo SIGNES
rjbs-perl-abe at lists.manxome.org
Thu Apr 26 18:57:49 PDT 2007
* "Faber J. Fedor" <faber at linuxnj.com> [2007-04-26T21:15:24]
> Using GetOpts, I usually have a command line options like --debug or
> --verbose which causes my program to spit out a lot of status
> messages/debug statements.
I use Getopt::Long::Descriptive and its bigger brother App::Cmd. At work, we
use a superset of that which integrates with Log::Speak to do this sort of
thing seamlessly. Still, you can just do this:
sub debug {
return unless $DEBUGGING;
print join '', @_, "\n";
}
debug "Your message here.";
Or you could have:
sub debug {
return unless $DEBUG_LEVEL >= 5;
...
}
...and have a "alert" and "info" sub for other debug levels.
See also Log::Dispatch, etc.
--
rjbs
More information about the ABE-pm
mailing list