man-pages/man3/LWP::Debug.3pm.html
2021-03-31 01:06:50 +01:00

96 lines
2.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of LWP::Debug</TITLE>
</HEAD><BODY>
<H1>LWP::Debug</H1>
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2019-11-29<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
LWP::Debug - deprecated
<A NAME="lbAC">&nbsp;</A>
<H2>DESCRIPTION</H2>
This module has been deprecated. Please see LWP::ConsoleLogger for your
debugging needs.
<P>
LWP::Debug is used to provide tracing facilities, but these are not used
by <FONT SIZE="-1">LWP</FONT> any more. The code in this module is kept around
(undocumented) so that 3rd party code that happens to use the old
interfaces continue to run.
<P>
One useful feature that LWP::Debug provided (in an imprecise and
troublesome way) was network traffic monitoring. The following
section provides some hints about recommended replacements.
<A NAME="lbAD">&nbsp;</A>
<H3>Network traffic monitoring</H3>
The best way to monitor the network traffic that <FONT SIZE="-1">LWP</FONT> generates is to
use an external <FONT SIZE="-1">TCP</FONT> monitoring program. The
WireShark &lt;<A HREF="http://www.wireshark.org/">http://www.wireshark.org/</A>&gt; program is highly recommended for this.
<P>
Another approach it to use a debugging <FONT SIZE="-1">HTTP</FONT> proxy server and make
<FONT SIZE="-1">LWP</FONT> direct all its traffic via this one. Call <TT>&quot;$ua-&gt;proxy&quot;</TT> to
set it up and then just use <FONT SIZE="-1">LWP</FONT> as before.
<P>
For less precise monitoring needs just setting up a few simple
handlers might do. The following example sets up handlers to dump the
request and response objects that pass through <FONT SIZE="-1">LWP:</FONT>
<P>
<PRE>
use LWP::UserAgent;
$ua = LWP::UserAgent-&gt;new;
$ua-&gt;default_header('Accept-Encoding' =&gt; scalar HTTP::Message::decodable());
$ua-&gt;add_handler(&quot;request_send&quot;, sub { shift-&gt;dump; return });
$ua-&gt;add_handler(&quot;response_done&quot;, sub { shift-&gt;dump; return });
$ua-&gt;get(&quot;<A HREF="http://www.example.com">http://www.example.com</A>&quot;);
</PRE>
<A NAME="lbAE">&nbsp;</A>
<H2>SEE ALSO</H2>
LWP::ConsoleLogger, LWP::ConsoleLogger::Everywhere, LWP::UserAgent
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">DESCRIPTION</A><DD>
<DL>
<DT id="3"><A HREF="#lbAD">Network traffic monitoring</A><DD>
</DL>
<DT id="4"><A HREF="#lbAE">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:47 GMT, March 31, 2021
</BODY>
</HTML>