NAME
LWP::Debug - debug routines
SYNOPSIS
use LWP::Debug;
level('+');
level('-conns');
trace('send()');
debug('url ok');
conns("read $n bytes: $data");
debugl("Resolving hostname '$host'");
$SIG{'ALRM'} = 't';
alarm(1);
sub t {
my $long = $LWP::Debug::longMsg();
my $msg = 'Timeout';
$msg .= ": $long" if defined $long;
die $msg;
}
DESCRIPTION
LWP::Debug provides tracing facilities. The trace
, debug
and conns
function log information at increasing levels of detail. Which level of detail is actually printed is controlled with the level()
function.
SEE ALSO
See LWP for a complete overview of libwww-perl5.
FUNCTIONS
trace($msg)
The trace()
function is used for tracing function calls. The package and calling subroutine name is printed along with the passed argument. This should be called at the start of every major function.
debug($msg)
The debug()
function is used for high-granularity reporting of state in functions.
conns($msg)
The conns()
function is used to show data being transferred over the connections. This may generate considerable output.
debugl($msg)
The debugl
function is meant for operations which take long time; The message is processed by debug()
, and stored for later use by for example an SIGALRM signal handler.
level(...)
The level()
function controls the level of detail being logged. Passing '+' or '-' indicates full and no logging respectively. Inidividual levels can switched on and of by passing the name of the level with a '+' or '-' prepended.
longMsg($msg)
Retrieve message set by debugl()