Debian Codegraph @

README

raw
1 NAME
2 Data::Dumper::Concise - Less indentation and newlines plus sub deparsing
3
4 SYNOPSIS
5 use Data::Dumper::Concise;
6
7 warn Dumper($var);
8
9 is equivalent to:
10
11 use Data::Dumper;
12 {
13 local $Data::Dumper::Terse = 1;
14 local $Data::Dumper::Indent = 1;
15 local $Data::Dumper::Useqq = 1;
16 local $Data::Dumper::Deparse = 1;
17 local $Data::Dumper::Quotekeys = 0;
18 local $Data::Dumper::Sortkeys = 1;
19 local $Data::Dumper::Trailingcomma = 1;
20 warn Dumper($var);
21 }
22
23 So for the structure:
24
25 { foo => "bar\nbaz", quux => sub { "fleem" } };
26
27 Data::Dumper::Concise will give you:
28
29 {
30 foo => "bar\nbaz",
31 quux => sub {
32 use warnings;
33 use strict 'refs';
34 'fleem';
35 },
36 }
37
38 instead of the default Data::Dumper output:
39
40 $VAR1 = {
41 'quux' => sub { "DUMMY" },
42 'foo' => 'bar
43 baz'
44 };
45
46 (note the tab indentation, oh joy ...)
47
48 (The trailing comma on the last element of an array or hash is enabled
49 by a new feature in Data::Dumper version 2.159, which was first released
50 in Perl 5.24. Using Data::Dumper::Concise with an older version of
51 Data::Dumper will still work, but you won't get those commas.)
52
53 If you need to get the underlying Dumper object just call
54 "DumperObject".
55
56 Also try out "DumperF" which takes a "CodeRef" as the first argument to
57 format the output. For example:
58
59 use Data::Dumper::Concise;
60
61 warn DumperF { "result: $_[0] result2: $_[1]" } $foo, $bar;
62
63 Which is the same as:
64
65 warn 'result: ' . Dumper($foo) . ' result2: ' . Dumper($bar);
66
67 DESCRIPTION
68 This module always exports a single function, Dumper, which can be
69 called with an array of values to dump those values.
70
71 It exists, fundamentally, as a convenient way to reproduce a set of
72 Dumper options that we've found ourselves using across large numbers of
73 applications, primarily for debugging output.
74
75 The principle guiding theme is "all the concision you can get while
76 still having a useful dump and not doing anything cleverer than setting
77 Data::Dumper options" - it's been pointed out to us that
78 Data::Dump::Streamer can produce shorter output with less lines of code.
79 We know. This is simpler and we've never seen it segfault. But for
80 complex/weird structures, it generally rocks. You should use it as well,
81 when Concise is underkill. We do.
82
83 Why is deparsing on when the aim is concision? Because you often want to
84 know what subroutine refs you have when debugging and because if you
85 were planning to eval this back in you probably wanted to remove subrefs
86 first and add them back in a custom way anyway. Note that this -does-
87 force using the pure perl Dumper rather than the XS one, but I've never
88 in my life seen Data::Dumper show up in a profile so "who cares?".
89
90 BUT BUT BUT ...
91 Yes, we know. Consider this module in the ::Tiny spirit and feel free to
92 write a Data::Dumper::Concise::ButWithExtraTwiddlyBits if it makes you
93 happy. Then tell us so we can add it to the see also section.
94
95 SUGARY SYNTAX
96 This package also provides:
97
98 Data::Dumper::Concise::Sugar - provides Dwarn and DwarnS convenience
99 functions
100
101 Devel::Dwarn - shorter form for Data::Dumper::Concise::Sugar
102
103 SEE ALSO
104 We use for some purposes, and dearly love, the following alternatives:
105
106 Data::Dump - prettiness oriented but not amazingly configurable
107
108 Data::Dump::Streamer - brilliant. beautiful. insane. extensive.
109 excessive. try it.
110
111 JSON::XS - no, really. If it's just plain data, JSON is a great option.
112
113 AUTHOR
114 mst - Matt S. Trout <[email protected]>
115
116 CONTRIBUTORS
117 frew - Arthur Axel "fREW" Schmidt <[email protected]>
118
119 COPYRIGHT
120 Copyright (c) 2010 the Data::Dumper::Concise "AUTHOR" and "CONTRIBUTORS"
121 as listed above.
122
123 LICENSE
124 This library is free software and may be distributed under the same
125 terms as perl itself.
126