debug.html
来自「perl教程」· HTML 代码 · 共 118 行
HTML
118 行
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>LWP::Debug - debug routines for the libwww-perl library</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>
<body>
<script>writelinks('__top__',2);</script>
<h1><a>LWP::Debug - debug routines for the libwww-perl library</a></h1>
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>LWP::Debug - debug routines for the libwww-perl library</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
<span class="keyword">use</span> <span class="variable">LWP::Debug</span> <span class="string">qw(+ -conns)</span><span class="operator">;</span>
</pre>
<pre>
<span class="comment"># Used internally in the library</span>
<span class="variable">LWP::Debug::trace</span><span class="operator">(</span><span class="string">'send()'</span><span class="operator">);</span>
<span class="variable">LWP::Debug::debug</span><span class="operator">(</span><span class="string">'url ok'</span><span class="operator">);</span>
<span class="variable">LWP::Debug::conns</span><span class="operator">(</span><span class="string">"read $n bytes: $data"</span><span class="operator">);</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>LWP::Debug provides tracing facilities. The trace(), <a href="#item_debug"><code>debug()</code></a> and
<a href="#item_conns"><code>conns()</code></a> function are called within the library and they log
information at increasing levels of detail. Which level of detail is
actually printed is controlled with the <a href="#item_level"><code>level()</code></a> function.</p>
<p>The following functions are available:</p>
<dl>
<dt><strong><a name="item_level"><code>level(...)</code></a></strong>
<dd>
<p>The <a href="#item_level"><code>level()</code></a> function controls the level of detail being
logged. Passing '+' or '-' indicates full and no logging
respectively. Individual levels can switched on and of by passing the
name of the level with a '+' or '-' prepended. The levels are:</p>
</dd>
<dd>
<pre>
trace : trace function calls
debug : print debug messages
conns : show all data transfered over the connections</pre>
</dd>
<dd>
<p>The LWP::Debug module provide a special <a href="../../lib/Pod/perlfunc.html#item_import"><code>import()</code></a> method that allows
you to pass the <a href="#item_level"><code>level()</code></a> arguments with initial use statement. If a
use argument start with '+' or '-' then it is passed to the level
function, else the name is exported as usual. The following two
statements are thus equivalent (if you ignore that the second pollutes
your namespace):</p>
</dd>
<dd>
<pre>
<span class="keyword">use</span> <span class="variable">LWP::Debug</span> <span class="string">qw(+)</span><span class="operator">;</span>
<span class="keyword">use</span> <span class="variable">LWP::Debug</span> <span class="string">qw(level)</span><span class="operator">;</span> <span class="variable">level</span><span class="operator">(</span><span class="string">'+'</span><span class="operator">);</span>
</pre>
</dd>
</li>
<dt><strong><a name="item_trace"><code>trace($msg)</code></a></strong>
<dd>
<p>The <a href="#item_trace"><code>trace()</code></a> 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.</p>
</dd>
</li>
<dt><strong><a name="item_debug"><code>debug($msg)</code></a></strong>
<dd>
<p>The <a href="#item_debug"><code>debug()</code></a> function is used for high-granularity
reporting of state in functions.</p>
</dd>
</li>
<dt><strong><a name="item_conns"><code>conns($msg)</code></a></strong>
<dd>
<p>The <a href="#item_conns"><code>conns()</code></a> function is used to show data being
transferred over the connections. This may generate
considerable output.</p>
</dd>
</li>
</dl>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?