1LWP::Debug(3) User Contributed Perl Documentation LWP::Debug(3)
2
3
4
6 LWP::Debug - debug routines for the libwww-perl library
7
9 use LWP::Debug qw(+ -conns);
10
11 # Used internally in the library
12 LWP::Debug::trace('send()');
13 LWP::Debug::debug('url ok');
14 LWP::Debug::conns("read $n bytes: $data");
15
17 LWP::Debug provides tracing facilities. The trace(), debug() and
18 conns() function are called within the library and they log information
19 at increasing levels of detail. Which level of detail is actually
20 printed is controlled with the "level()" function.
21
22 The following functions are available:
23
24 level(...)
25 The "level()" function controls the level of detail being logged.
26 Passing '+' or '-' indicates full and no logging respectively.
27 Individual levels can switched on and of by passing the name of the
28 level with a '+' or '-' prepended. The levels are:
29
30 trace : trace function calls
31 debug : print debug messages
32 conns : show all data transfered over the connections
33
34 The LWP::Debug module provide a special import() method that allows
35 you to pass the level() arguments with initial use statement. If a
36 use argument start with '+' or '-' then it is passed to the level
37 function, else the name is exported as usual. The following two
38 statements are thus equivalent (if you ignore that the second pol‐
39 lutes your namespace):
40
41 use LWP::Debug qw(+);
42 use LWP::Debug qw(level); level('+');
43
44 trace($msg)
45 The "trace()" function is used for tracing function calls. The
46 package and calling subroutine name is printed along with the
47 passed argument. This should be called at the start of every major
48 function.
49
50 debug($msg)
51 The "debug()" function is used for high-granularity reporting of
52 state in functions.
53
54 conns($msg)
55 The "conns()" function is used to show data being transferred over
56 the connections. This may generate considerable output.
57
58
59
60perl v5.8.8 2004-04-06 LWP::Debug(3)