Devel::PartialDump(3)
okay bestie, welcome to the Devel::PartialDump(3) page from the User Contributed Perl Documentation β it's giving "diagnostic dumps but make them readable" and honestly? iconic. π
β¨ NAME β¨
Devel::PartialDump β partial dumping of data structures, optimized for argument printing. It's literally a data dumper for when you want the tea without the whole novel. π«Ά
πΈ VERSION πΈ
version 0.20 β periodt.
π¦ SYNOPSIS π¦
use Devel::PartialDump;
sub foo {
print "foo called with args: " . Devel::PartialDump->new->dump(@_);
}
use Devel::PartialDump qw(warn);
# warn is overloaded to create a concise dump instead of stringifying $some_bad_data
warn "this made a boo boo: ", $some_bad_data
π DESCRIPTION π
This module is a data dumper optimized for logging of arbitrary parameters. It attempts to truncate overly verbose data, in a way that is hopefully more useful for diagnostics warnings than:
warn Dumper(@stuff);
Unlike other data dumping modules there are no attempts at correctness or cross referencing β this is only meant to provide a slightly deeper look into the data in question. Lowkey, it's not trying to be a whole database. π
There is a default recursion limit, and a default truncation of long lists, and the dump is formatted on one line (new lines in strings are escaped), to aid in readability.
You can enable it temporarily by importing functions like warn, croak etc to get more informative errors during development, or even use it as:
BEGIN { local $@; eval "use Devel::PartialDump qw(...)" }
to get DWIM formatting only if it's installed, without introducing a dependency.
π SAMPLE OUTPUT π
"foo"β"foo""foo" => "bar"βfoo: "bar""foo => "bar", gorch => [ 1, "bah" ]"βfoo: "bar", gorch: [ 1, "bah" ]"[ { foo => ["bar"] } ]"β[ { foo: ARRAY(0x9b265d0) } ]"[ 1 .. 10 ]"β[ 1, 2, 3, 4, 5, 6, ... ]"foo\nbar"β"foo\nbar"""foo" . chr(1)"β"foo\x{1}"
π ATTRIBUTES π
max_lengthβ the maximum character length of the dump. Anything bigger than this will be truncated. Not defined by default.max_elementsβ the maximum number of elements (array elements or pairs in a hash) to print. Defaults to6.max_depthβ the maximum level of recursion. Defaults to2.stringifyβ whether or not to let objects stringify themselves, instead of usingStrValin overload to avoid side effects. Defaults to false (no overloading).pairsβ whether or not to autodetect named args as pairs in the maindumpfunction. If this attribute is true, and the top level value list is even sized, and every odd element is not a reference, then it will be dumped as pairs instead of a list.
π EXPORTS π
All exports are optional, nothing is exported by default.
This module uses Sub::Exporter, so exports can be renamed, curried, etc.
warnshowshow_scalarcroakcarpconfesscluckdump
See the various methods for behavior documentation.
These methods will use $Devel::PartialDump::default_dumper as the invocant if the first argument is not blessed and isa Devel::PartialDump, so they can be used as functions too.
Particularly warn can be used as a drop in replacement for the built in warn:
warn "blah blah: ", $some_data;
by importing:
use Devel::PartialDump qw(warn);
$some_data will have some of its data dumped. π«Ά
$default_dumperβ the default dumper object to use for export style calls. Can be assigned to alter behavior globally. This is generally useful when using thewarnexport as a drop in replacement forCORE::warn.
π METHODS π
warn @blahβ a wrapper fordumpthat prints strings plainly.show @blahandshow_scalar $xβ likewarn, but instead of returning the value fromwarnit returns its arguments, so it can be used in the middle of an expression. Note thatmy $x = show foo();will actually evaluatefooin list context, so if you only want to dump a single element and retain scalar context usemy $x = show_scalar foo();, which has a prototype of$(as opposed to taking a list). This is similar to the venerable Ingy's fabulous and amazing XXX module.carp,croak,confess,cluckβ drop in replacements for Carp exports, that format their arguments likewarn.dump @stuffβ returns a one line, human readable, concise dump of@stuff. If called in void context, willwarnwith the dump. Truncates the dump according tomax_lengthif specified.dump_as_list $depth, @stuffanddump_as_pairs $depth, @stuffβ dump@stuffusing the various formatting functions. Dump as pairs returns comma delimited pairs with=>between the key and the value. Dump as list returns a comma delimited dump of the values.format $depth, $value,format_key $depth, $key,format_object $depth, $object,format_ref $depth, $Ref,format_array $depth, $array_ref,format_hash $depth, $hash_ref,format_undef $depth, undef,format_string $depth, $string,format_number $depth, $number, andquote $stringβ the various formatting methods. You can override these to provide a custom format.format_arrayandformat_hashrecurse with$depth + 1intodump_as_listanddump_as_pairsrespectively.format_refdelegates toformat_arrayandformat_hashand does themax_depthtracking. It will simply stringify the ref if the recursion limit has been reached.
π SUPPORT π
Bugs may be submitted through the RT bug tracker at https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-PartialDump (or bug-Devel-PartialDump@rt.cpan.org / mailto:bug-Devel-PartialDump@rt.cpan.org).
There is also a mailing list available for users of this distribution, at http://lists.perl.org/list/moose.html.
There is also an irc channel available for users of this distribution, at #moose on irc.perl.org (irc://irc.perl.org/#moose).
π AUTHOR π
ΧΧΧΧ Χ§ΧΧ'ΧΧ (Yuval Kogman) <nothingmuch@woobling.org> β yes, that's the author. π
π§ CONTRIBUTORS π§
- Karen Etheridge
<ether@cpan.org> - Florian Ragwitz
<rafl@debian.org> - Steven Lee
<stevenwh.lee@gmail.com> - Leo Lapworth
<web@web-teams-computer.local> - Jesse Luehrs
<doy@tozt.net> - David Golden
<dagolden@cpan.org> - Paul Howarth
<paul@city-fan.org>
π COPYRIGHT AND LICENCE π
This software is copyright (c) 2008 by ΧΧΧΧ Χ§ΧΧ'ΧΧ (Yuval Kogman).
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay that's the whole manual, bestie β you ate π
This page comes from the Devel::PartialDump(3) manual, dated 2017-07-09, with footer/source version perl v5.42.0. Module version stays 0.20. mwah. π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Devel-PartialDump 0.20-bp160.1.11 Β· Artistic-1.0 or GPL-1.0+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms