man-pages/man3/Data::Dump::Trace.3pm.html
2021-03-31 01:06:50 +01:00

257 lines
5.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Data::Dump::Trace</TITLE>
</HEAD><BODY>
<H1>Data::Dump::Trace</H1>
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2013-05-16<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>
Data::Dump::Trace - Helpers to trace function and method calls
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
use Data::Dump::Trace qw(autowrap mcall);
autowrap(&quot;LWP::UserAgent&quot; =&gt; &quot;ua&quot;, &quot;HTTP::Response&quot; =&gt; &quot;res&quot;);
use LWP::UserAgent;
$ua = mcall(LWP::UserAgent =&gt; &quot;new&quot;); # instead of LWP::UserAgent-&gt;new;
$ua-&gt;get(&quot;<A HREF="http://www.example.com">http://www.example.com</A>&quot;)-&gt;dump;
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The following functions are provided:
<DL COMPACT>
<DT id="1">autowrap( $class )<DD>
<DT id="2">autowrap( $class =&gt; $prefix )<DD>
<DT id="3">autowrap( $class1 =&gt; $prefix1, $class2 =&gt; $prefix2, ... )<DD>
<DT id="4">autowrap( $class1 =&gt; \%info1, $class2 =&gt; \%info2, ... )<DD>
Register classes whose objects are automatically wrapped when
returned by one of the call functions below. If <TT>$prefix</TT> is provided
it will be used as to name the objects.
<P>
Alternative is to pass an <TT>%info</TT> hash for each class. The recognized keys are:
<DL COMPACT><DT id="5"><DD>
<DL COMPACT>
<DT id="6">prefix =&gt; $string<DD>
The prefix string used to name objects of this type.
<DT id="7">proto =&gt; \%hash<DD>
A hash of prototypes to use for the methods when an object is wrapped.
</DL>
</DL>
<DL COMPACT><DT id="8"><DD>
</DL>
<DT id="9">wrap( name =&gt; $str, func =&gt; \&amp;func, proto =&gt; $proto )<DD>
<DT id="10">wrap( name =&gt; $str, obj =&gt; $obj, proto =&gt; \%hash )<DD>
Returns a wrapped function or object. When a wrapped function is
invoked then a trace is printed after the underlying function has returned.
When a method on a wrapped object is invoked then a trace is printed
after the methods on the underlying objects has returned.
<P>
See ``Prototypes'' for description of the <TT>&quot;proto&quot;</TT> argument.
<DT id="11">call( $name, \&amp;func, $proto, @ARGS )<DD>
Calls the given function with the given arguments. The trace will use
<TT>$name</TT> as the name of the function.
<P>
See ``Prototypes'' for description of the <TT>$proto</TT> argument.
<DT id="12">mcall( $class, $method, $proto, @ARGS )<DD>
<DT id="13">mcall( $object, $method, $proto, @ARGS )<DD>
Calls the given method with the given arguments.
<P>
See ``Prototypes'' for description of the <TT>$proto</TT> argument.
<DT id="14">trace( $symbol, $prototype )<DD>
Replaces the function given by <TT>$symbol</TT> with a wrapped function.
</DL>
<A NAME="lbAE">&nbsp;</A>
<H3>Prototypes</H3>
<B>Note: The prototype string syntax described here is experimental and
likely to change in revisions of this interface</B>.
<P>
The <TT>$proto</TT> argument to <I>call()</I> and <I>mcall()</I> can optionally provide a
prototype for the function call. This give the tracer hints about how
to best format the argument lists and if there are <I>in/out</I> or <I>out</I>
arguments. The general form for the prototype string is:
<P>
<PRE>
&lt;arguments&gt; = &lt;return_value&gt;
</PRE>
<P>
The default prototype is ``@ = @''; list of values as input and list of
values as output.
<P>
The value '%' can be used for both arguments and return value to say
that key/value pair style lists are used.
<P>
Alternatively, individual positional arguments can be listed each
represented by a letter:
<DL COMPACT>
<DT id="15">&quot;i&quot;<DD>
input argument
<DT id="16">&quot;o&quot;<DD>
output argument
<DT id="17">&quot;O&quot;<DD>
both input and output argument
</DL>
<P>
If the return value prototype has <TT>&quot;!&quot;</TT> appended, then it signals that
this function sets errno ($!) when it returns a false value. The
trace will display the current value of errno in that case.
<P>
If the return value prototype looks like a variable name (with <TT>&quot;$&quot;</TT>
prefix), and the function returns a blessed object, then the variable
name will be used as prefix and the returned object automatically
traced.
<A NAME="lbAF">&nbsp;</A>
<H2>SEE ALSO</H2>
Data::Dump
<A NAME="lbAG">&nbsp;</A>
<H2>AUTHOR</H2>
Copyright 2009 Gisle Aas.
<P>
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="18"><A HREF="#lbAB">NAME</A><DD>
<DT id="19"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="20"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DL>
<DT id="21"><A HREF="#lbAE">Prototypes</A><DD>
</DL>
<DT id="22"><A HREF="#lbAF">SEE ALSO</A><DD>
<DT id="23"><A HREF="#lbAG">AUTHOR</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:38 GMT, March 31, 2021
</BODY>
</HTML>