Data::Dump::Trace(3)
π Data::Dump::Trace(3) π
okay bestie, this is Data::Dump::Trace from the User Contributed Perl Documentation, and it is literally the manual page for helpers that trace function and method calls. no cap, it's giving debugging main character energy β¨
πΈ NAME πΈ
Data::Dump::Trace β Helpers to trace function and method calls π«Ά
β¨ SYNOPSIS β¨
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("http://www.example.com")->dump;
π¦ DESCRIPTION π¦
The following functions are provided, and they are all iconic:
autowrap( $class )autowrap( $class => $prefix )autowrap( $class1 => $prefix1, $class2 => $prefix2, ... )autowrap( $class1 => \%info1, $class2 => \%info2, ... )β register classes whose objects are automatically wrapped when returned by one of the call functions below. If$prefixis provided it will be used as to name the objects.
Alternative is to pass an %info hash for each class. The recognized keys are:
prefix => $stringβ the prefix string used to name objects of this type.proto => \%hashβ a hash of prototypes to use for the methods when an object is wrapped.
wrap( name => $str, func => \&func, proto => $proto )wrap( name => $str, obj => $obj, proto => \%hash )β 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.
See "Prototypes" for description of the proto argument.
call( $name, \&func, $proto, @ARGS )β calls the given function with the given arguments. The trace will use$nameas the name of the function.
See "Prototypes" for description of the $proto argument.
mcall( $class, $method, $proto, @ARGS )mcall( $object, $method, $proto, @ARGS )β calls the given method with the given arguments.
See "Prototypes" for description of the $proto argument.
trace( $symbol, $prototype )β replaces the function given by$symbolwith a wrapped function.
π§ͺ Prototypes π§ͺ
β οΈ Note: The prototype string syntax described here is experimental and likely to change in revisions of this interface.
The $proto argument to call() and mcall() 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 in/out or out arguments. The general form for the prototype string is:
<arguments> = <return_value>
The default prototype is "@ = @"; list of values as input and list of values as output.
The value '%' can be used for both arguments and return value to say that key/value pair style lists are used.
Alternatively, individual positional arguments can be listed each represented by a letter:
"i"β input argument"o"β output argument"O"β both input and output argument
If the return value prototype has "!" 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.
If the return value prototype looks like a variable name (with "$" prefix), and the function returns a blessed object, then the variable name will be used as prefix and the returned object automatically traced.
π SEE ALSO π
Data::Dump π
xoxo, bestie π β this page is perl v5.42.0, dated 2021-06-29, and it is the manual for Data::Dump::Trace(3). go trace something cute π¦β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Data-Dump 1.25-160000.2.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms