1 .\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.10)
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
9 .de Vb \" Begin verbatim text
14 .de Ve \" End verbatim text
18 .\" Set up some character translations and predefined strings. \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote. \*(C+ will
21 .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
29 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
43 .\" Escape single quotes in literal strings from groff's Unicode transform.
47 .\" If the F register is turned on, we'll generate index entries on stderr for
48 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49 .\" entries marked with X<> in POD. Of course, you'll have to process the
50 .\" output yourself in some meaningful fashion.
53 . tm Index:\\$1\t\\n%\t"\\$2"
63 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64 .\" Fear. Run. Save yourself. No user-serviceable parts.
65 . \" fudge factors for nroff and troff
74 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80 . \" simple accents for nroff and troff
90 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
97 . \" troff and (daisy-wheel) nroff accents
98 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105 .ds ae a\h'-(\w'a'u*4/10)'e
106 .ds Ae A\h'-(\w'A'u*4/10)'E
107 . \" corrections for vroff
108 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110 . \" for low resolution devices (crt and lpr)
111 .if \n(.H>23 .if \n(.V>19 \
124 .\" ========================================================================
126 .IX Title "Devel::PartialDump 3"
127 .TH Devel::PartialDump 3 "2009-11-08" "perl v5.8.7" "User Contributed Perl Documentation"
128 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
129 .\" way too many mistakes in technical documents.
133 Devel::PartialDump \- Partial dumping of data structures, optimized for argument
136 .IX Header "SYNOPSIS"
138 \& use Devel::PartialDump;
141 \& print "foo called with args: " . Devel::PartialDump\->new\->dump(@_);
144 \& use Devel::PartialDump qw(warn);
146 \& # warn is overloaded to create a concise dump instead of stringifying $some_bad_data
147 \& warn "this made a boo boo: ", $some_bad_data
150 .IX Header "DESCRIPTION"
151 This module is a data dumper optimized for logging of arbitrary parameters.
153 It attempts to truncate overly verbose data, in a way that is hopefully more
154 useful for diagnostics warnings than
157 \& warn Dumper(@stuff);
160 Unlike other data dumping modules there are no attempts at correctness or cross
161 referencing, this is only meant to provide a slightly deeper look into the data
164 There is a default recursion limit, and a default truncation of long lists, and
165 the dump is formatted on one line (new lines in strings are escaped), to aid in
168 You can enable it temporarily by importing functions like \f(CW\*(C`warn\*(C'\fR, \f(CW\*(C`croak\*(C'\fR etc
169 to get more informative errors during development, or even use it as:
172 \& BEGIN { local $@; eval "use Devel::PartialDump qw(...)" }
175 to get \s-1DWIM\s0 formatting only if it's installed, without introducing a
178 .IX Header "SAMPLE OUTPUT"
179 .ie n .IP """foo""" 4
180 .el .IP "\f(CW``foo''\fR" 4
185 .ie n .IP """foo"" => ""bar""" 4
186 .el .IP "\f(CW``foo'' => ``bar''\fR" 4
187 .IX Item """foo"" => ""bar"""
191 .ie n .IP """foo => ""bar"", gorch => [ 1, ""bah"" ]""" 4
192 .el .IP "\f(CWfoo => ``bar'', gorch => [ 1, ``bah'' ]\fR" 4
193 .IX Item "foo => ""bar"", gorch => [ 1, ""bah"" ]"
195 \& foo: "bar", gorch: [ 1, "bah" ]
197 .ie n .IP """[ { foo => [""bar""] } ]""" 4
198 .el .IP "\f(CW[ { foo => [``bar''] } ]\fR" 4
199 .IX Item "[ { foo => [""bar""] } ]"
201 \& [ { foo: ARRAY(0x9b265d0) } ]
203 .ie n .IP """[ 1 .. 10 ]""" 4
204 .el .IP "\f(CW[ 1 .. 10 ]\fR" 4
205 .IX Item "[ 1 .. 10 ]"
207 \& [ 1, 2, 3, 4, 5, 6, ... ]
209 .ie n .IP """foo\enbar""" 4
210 .el .IP "\f(CW``foo\enbar''\fR" 4
211 .IX Item """foonbar"""
215 .ie n .IP """""foo"" . chr(1)""" 4
216 .el .IP "\f(CW``foo'' . chr(1)\fR" 4
217 .IX Item """foo"" . chr(1)"
222 .IX Header "ATTRIBUTES"
224 .IX Item "max_length"
225 The maximum character length of the dump.
227 Anything bigger than this will be truncated.
229 Not defined by default.
231 .IX Item "max_elements"
232 The maximum number of elements (array elements or pairs in a hash) to print.
237 The maximum level of recursion.
242 Whether or not to let objects stringify themeslves, instead of using
243 \&\*(L"StrVal\*(R" in overload to avoid sideffects.
245 Defaults to false (no overloading).
248 Whether or not to autodetect named args as pairs in the main \f(CW\*(C`dump\*(C'\fR function.
249 If this attribute is true, and the top level value list is even sized, and
250 every odd element is not a reference, then it will dumped as pairs instead of a
254 All exports are optional, nothing is exported by default.
256 This module uses Sub::Exporter, so exports can be renamed, curried, etc.
263 .IX Item "show_scalar"
275 See the various methods for behavior documentation.
277 These methods will use \f(CW$Devel::PartialDump::default_dumper\fR as the invocant if the
278 first argument is not blessed and \f(CW\*(C`isa\*(C'\fR Devel::PartialDump, so they can be
279 used as functions too.
281 Particularly \f(CW\*(C`warn\*(C'\fR can be used as a drop in replacement for the built in
285 \& warn "blah blah: ", $some_data;
291 \& use Devel::PartialDump qw(warn);
294 \&\f(CW$some_data\fR will be have some of it's data dumped.
295 .ie n .IP "$default_dumper" 4
296 .el .IP "\f(CW$default_dumper\fR" 4
297 .IX Item "$default_dumper"
298 The default dumper object to use for export style calls.
300 Can be assigned to to alter behavior globally.
302 This is generally useful when using the \f(CW\*(C`warn\*(C'\fR export as a drop in replacement
303 for \f(CW\*(C`CORE::warn\*(C'\fR.
306 .ie n .IP "warn @blah" 4
307 .el .IP "warn \f(CW@blah\fR" 4
308 .IX Item "warn @blah"
309 A warpper for \f(CW\*(C`dump\*(C'\fR that prints strings plainly.
310 .ie n .IP "show @blah" 4
311 .el .IP "show \f(CW@blah\fR" 4
312 .IX Item "show @blah"
314 .ie n .IP "show_scalar $x" 4
315 .el .IP "show_scalar \f(CW$x\fR" 4
316 .IX Item "show_scalar $x"
318 Like \f(CW\*(C`warn\*(C'\fR, but instead of returning the value from \f(CW\*(C`warn\*(C'\fR it returns its
319 arguments, so it can be used in the middle of an expression.
324 \& my $x = show foo();
327 will actually evaluaate \f(CW\*(C`foo\*(C'\fR in list context, so if you only want to dump a
328 single element and retain scalar context use
331 \& my $x = show_scalar foo();
334 which has a prototype of \f(CW\*(C`$\*(C'\fR (as opposed to taking a list).
336 This is similar to the venerable Ingy's fabulous and amazing \s-1XXX\s0 module.
347 Drop in replacements for Carp exports, that format their arguments like
348 \&\f(CW\*(C`warn\*(C'\fR.
349 .ie n .IP "dump @stuff" 4
350 .el .IP "dump \f(CW@stuff\fR" 4
351 .IX Item "dump @stuff"
352 Returns a one line, human readable, concise dump of \f(CW@stuff\fR.
354 If called in void context, will \f(CW\*(C`warn\*(C'\fR with the dump.
356 Truncates the dump according to \f(CW\*(C`max_length\*(C'\fR if specified.
357 .ie n .IP "dump_as_list $depth, @stuff" 4
358 .el .IP "dump_as_list \f(CW$depth\fR, \f(CW@stuff\fR" 4
359 .IX Item "dump_as_list $depth, @stuff"
361 .ie n .IP "dump_as_pairs $depth, @stuff" 4
362 .el .IP "dump_as_pairs \f(CW$depth\fR, \f(CW@stuff\fR" 4
363 .IX Item "dump_as_pairs $depth, @stuff"
365 Dump \f(CW@stuff\fR using the various formatting functions.
367 Dump as pairs returns comma delimited pairs with \f(CW\*(C`=>\*(C'\fR between the key and the value.
369 Dump as list returns a comma delimited dump of the values.
370 .ie n .IP "frmat $depth, $value" 4
371 .el .IP "frmat \f(CW$depth\fR, \f(CW$value\fR" 4
372 .IX Item "frmat $depth, $value"
374 .ie n .IP "format_key $depth, $key" 4
375 .el .IP "format_key \f(CW$depth\fR, \f(CW$key\fR" 4
376 .IX Item "format_key $depth, $key"
377 .ie n .IP "format_object $depth, $object" 4
378 .el .IP "format_object \f(CW$depth\fR, \f(CW$object\fR" 4
379 .IX Item "format_object $depth, $object"
380 .ie n .IP "format_ref $depth, $Ref" 4
381 .el .IP "format_ref \f(CW$depth\fR, \f(CW$Ref\fR" 4
382 .IX Item "format_ref $depth, $Ref"
383 .ie n .IP "format_array $depth, $array_ref" 4
384 .el .IP "format_array \f(CW$depth\fR, \f(CW$array_ref\fR" 4
385 .IX Item "format_array $depth, $array_ref"
386 .ie n .IP "format_hash $depth, $hash_ref" 4
387 .el .IP "format_hash \f(CW$depth\fR, \f(CW$hash_ref\fR" 4
388 .IX Item "format_hash $depth, $hash_ref"
389 .ie n .IP "format_undef $depth, undef" 4
390 .el .IP "format_undef \f(CW$depth\fR, undef" 4
391 .IX Item "format_undef $depth, undef"
392 .ie n .IP "format_string $depth, $string" 4
393 .el .IP "format_string \f(CW$depth\fR, \f(CW$string\fR" 4
394 .IX Item "format_string $depth, $string"
395 .ie n .IP "format_number $depth, $number" 4
396 .el .IP "format_number \f(CW$depth\fR, \f(CW$number\fR" 4
397 .IX Item "format_number $depth, $number"
398 .ie n .IP "quote $string" 4
399 .el .IP "quote \f(CW$string\fR" 4
400 .IX Item "quote $string"
402 The various formatting methods.
404 You can override these to provide a custom format.
406 \&\f(CW\*(C`format_array\*(C'\fR and \f(CW\*(C`format_hash\*(C'\fR recurse with \f(CW\*(C`$depth + 1\*(C'\fR into
407 \&\f(CW\*(C`dump_as_list\*(C'\fR and \f(CW\*(C`dump_as_pairs\*(C'\fR respectively.
409 \&\f(CW\*(C`format_ref\*(C'\fR delegates to \f(CW\*(C`format_array\*(C'\fR and \f(CW\*(C`format_hash\*(C'\fR and does the
410 \&\f(CW\*(C`max_depth\*(C'\fR tracking. It will simply stringify the ref if the recursion limit
412 .SH "VERSION CONTROL"
413 .IX Header "VERSION CONTROL"
414 This module is maintained using git. You can get the latest version from
415 <http://github.com/nothingmuch/devel\-partialdump>.
418 Yuval Kogman <nothingmuch@woobling.org>
420 .IX Header "COPYRIGHT"
422 \& Copyright (c) 2008, 2009 Yuval Kogman. All rights reserved
423 \& This program is free software; you can redistribute
424 \& it and/or modify it under the same terms as Perl itself.