1Data::Dumper::Concise(3U)ser Contributed Perl DocumentatiDoanta::Dumper::Concise(3)
2
3
4

NAME

6       Data::Dumper::Concise - Less indentation and newlines plus sub
7       deparsing
8

SYNOPSIS

10         use Data::Dumper::Concise;
11
12         warn Dumper($var);
13
14       is equivalent to:
15
16         use Data::Dumper;
17         {
18           local $Data::Dumper::Terse = 1;
19           local $Data::Dumper::Indent = 1;
20           local $Data::Dumper::Useqq = 1;
21           local $Data::Dumper::Deparse = 1;
22           local $Data::Dumper::Quotekeys = 0;
23           local $Data::Dumper::Sortkeys = 1;
24           local $Data::Dumper::Trailingcomma = 1;
25           warn Dumper($var);
26         }
27
28       So for the structure:
29
30         { foo => "bar\nbaz", quux => sub { "fleem" } };
31
32       Data::Dumper::Concise will give you:
33
34         {
35           foo => "bar\nbaz",
36           quux => sub {
37               use warnings;
38               use strict 'refs';
39               'fleem';
40           },
41         }
42
43       instead of the default Data::Dumper output:
44
45         $VAR1 = {
46          'quux' => sub { "DUMMY" },
47          'foo' => 'bar
48         baz'
49         };
50
51       (note the tab indentation, oh joy ...)
52
53       (The trailing comma on the last element of an array or hash is enabled
54       by a new feature in Data::Dumper version 2.159, which was first
55       released in Perl 5.24.  Using Data::Dumper::Concise with an older
56       version of Data::Dumper will still work, but you won't get those
57       commas.)
58
59       If you need to get the underlying Dumper object just call
60       "DumperObject".
61
62       Also try out "DumperF" which takes a "CodeRef" as the first argument to
63       format the output.  For example:
64
65         use Data::Dumper::Concise;
66
67         warn DumperF { "result: $_[0] result2: $_[1]" } $foo, $bar;
68
69       Which is the same as:
70
71         warn 'result: ' . Dumper($foo) . ' result2: ' . Dumper($bar);
72

DESCRIPTION

74       This module always exports a single function, Dumper, which can be
75       called with an array of values to dump those values.
76
77       It exists, fundamentally, as a convenient way to reproduce a set of
78       Dumper options that we've found ourselves using across large numbers of
79       applications, primarily for debugging output.
80
81       The principle guiding theme is "all the concision you can get while
82       still having a useful dump and not doing anything cleverer than setting
83       Data::Dumper options" - it's been pointed out to us that
84       Data::Dump::Streamer can produce shorter output with less lines of
85       code. We know. This is simpler and we've never seen it segfault. But
86       for complex/weird structures, it generally rocks.  You should use it as
87       well, when Concise is underkill. We do.
88
89       Why is deparsing on when the aim is concision? Because you often want
90       to know what subroutine refs you have when debugging and because if you
91       were planning to eval this back in you probably wanted to remove
92       subrefs first and add them back in a custom way anyway. Note that this
93       -does- force using the pure perl Dumper rather than the XS one, but
94       I've never in my life seen Data::Dumper show up in a profile so "who
95       cares?".
96

BUT BUT BUT ...

98       Yes, we know. Consider this module in the ::Tiny spirit and feel free
99       to write a Data::Dumper::Concise::ButWithExtraTwiddlyBits if it makes
100       you happy. Then tell us so we can add it to the see also section.
101

SUGARY SYNTAX

103       This package also provides:
104
105       Data::Dumper::Concise::Sugar - provides Dwarn and DwarnS convenience
106       functions
107
108       Devel::Dwarn - shorter form for Data::Dumper::Concise::Sugar
109

SEE ALSO

111       We use for some purposes, and dearly love, the following alternatives:
112
113       Data::Dump - prettiness oriented but not amazingly configurable
114
115       Data::Dump::Streamer - brilliant. beautiful. insane. extensive.
116       excessive. try it.
117
118       JSON::XS - no, really. If it's just plain data, JSON is a great option.
119

AUTHOR

121       mst - Matt S. Trout <mst@shadowcat.co.uk>
122

CONTRIBUTORS

124       frew - Arthur Axel "fREW" Schmidt <frioux@gmail.com>
125
127       Copyright (c) 2010 the Data::Dumper::Concise "AUTHOR" and
128       "CONTRIBUTORS" as listed above.
129

LICENSE

131       This library is free software and may be distributed under the same
132       terms as perl itself.
133
134
135
136perl v5.36.0                      2022-07-22          Data::Dumper::Concise(3)
Impressum