257 lines
5.1 KiB
HTML
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"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Data::Dump::Trace - Helpers to trace function and method calls
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
use Data::Dump::Trace qw(autowrap mcall);
|
|
|
|
autowrap("LWP::UserAgent" => "ua", "HTTP::Response" => "res");
|
|
|
|
use LWP::UserAgent;
|
|
$ua = mcall(LWP::UserAgent => "new"); # instead of LWP::UserAgent->new;
|
|
$ua->get("<A HREF="http://www.example.com">http://www.example.com</A>")->dump;
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
The following functions are provided:
|
|
<DL COMPACT>
|
|
<DT id="1">autowrap( $class )<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="2">autowrap( $class => $prefix )<DD>
|
|
|
|
|
|
|
|
|
|
<DT id="3">autowrap( $class1 => $prefix1, $class2 => $prefix2, ... )<DD>
|
|
|
|
|
|
|
|
|
|
<DT id="4">autowrap( $class1 => \%info1, $class2 => \%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 => $string<DD>
|
|
|
|
|
|
|
|
|
|
The prefix string used to name objects of this type.
|
|
<DT id="7">proto => \%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 => $str, func => \&func, proto => $proto )<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="10">wrap( name => $str, obj => $obj, proto => \%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>"proto"</TT> argument.
|
|
<DT id="11">call( $name, \&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"> </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>
|
|
<arguments> = <return_value>
|
|
|
|
</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">"i"<DD>
|
|
|
|
|
|
|
|
|
|
input argument
|
|
<DT id="16">"o"<DD>
|
|
|
|
|
|
|
|
|
|
output argument
|
|
<DT id="17">"O"<DD>
|
|
|
|
|
|
|
|
|
|
both input and output argument
|
|
</DL>
|
|
<P>
|
|
|
|
If the return value prototype has <TT>"!"</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>"$"</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"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
Data::Dump
|
|
<A NAME="lbAG"> </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"> </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>
|