NAME
DD - Dump data structure for debugging
VERSION
This document describes version 0.006 of DD (from Perl distribution DD),
released on 2019-08-08.
SYNOPSIS
To install this module, currently do:
% cpanm -n DD::Dummy
In your code:
use DD; # exports dd(), dd_warn(), dd_die(), dmp()
...
dd $data ; # prints data to STDOUT, return argument
my $foo = dd $data ; # ... so you can use it inside expression
my $foo = dd_warn $data ; # just like dd() but warns instead
dd_die $data ; # just like dd() but dies instead
my $dmp = dmp $data ; # dump data as string and return it
On the command-line:
% perl -MDD -E'...; dd $data; ...'
DESCRIPTION
"DD" is a module with a short name you can use for debugging. It
provides "dd" which dumps data structure to STDOUT, as well as return
the original data so you can insert "dd" in the middle of expressions.
It also provides "dd_warn", "dd_die", as well as "dmp" for completeness.
"DD" can use several kinds of backends. The default is Data::Dump which
is chosen because it's a mature module and produces visually nice dumps
for debugging. You can also use these other backends:
* Data::Dmp
Optional dependency. Compact output.
* Data::Dump::Color
Optional dependency. Colored output.
* Data::Dump::PHP
Optional dependency.
See also: PHP::Serialization.
* Data::Dumper
Optional dependency. A core module.
* Data::Dumper::Compact
Optional dependency.
* Data::Format::Pretty::Console
Optional dependency. Colored output.
* Data::Format::Pretty::SimpleText
Optional dependency.
* Data::Format::Pretty::Text
Optional dependency. Colored output.
* Data::Printer
Optional dependency. Colored output.
* JSON::Color
Optional dependency. Colored output.
Note that the JSON format cannot handle some kinds of Perl data
(e.g. typeglobs, recursive structure). You might want to "clean" the
data first before dumping using Data::Clean::ForJSON.
* JSON::MaybeXS
Optional dependency.
Note that the JSON format cannot handle some kinds of Perl data
(e.g. typeglobs, recursive structure). You might want to "clean" the
data first before dumping using Data::Clean::ForJSON.
* JSON::PP
Optional dependency, a core module.
Note that the JSON format cannot handle some kinds of Perl data
(e.g. typeglobs, recursive structure). You might want to "clean" the
data first before dumping using Data::Clean::ForJSON.
* PHP::Serialization
Optional dependency. Compact output.
See also: "Data::Dump::PHP".
* YAML
Optional dependency.
* YAML::Tiny::Color
Optional dependency. Colored output.
Note that this dumper cannot handle some kinds of Perl data (e.g.
recursive references). You might want to "clean" the data first
before dumping using Data::Clean or Data::Clean::ForJSON.
PACKAGE VARIABLES
$BACKEND
The backend to use. The default is to use "PERL_DD_BACKEND" environment
variable or "Data::Dump" as the fallback default.
FUNCTIONS
dd
Print the dump of its arguments to STDOUT, and return its arguments.
dd_warn
Warn the dump of its arguments, and return its arguments. If you want a
full stack trace, you can use Devel::Confess, e.g. on the command-line:
% perl -d:Confess -MDD -E'... dd_warn $data;'
dd_die
Die with the dump of its arguments as message. If you want a full stack
trace, you can use Devel::Confess, e.g. on the command-line:
% perl -d:Confess -MDD -E'... dd_die $data;'
dmp
Dump its arguments as string and return it.
ENVIRONMENT
PERL_DD_BACKEND
Can be used to set the default backend.
HOMEPAGE
Please visit the project's homepage at
<https://metacpan.org/release/DD>.
SOURCE
Source repository is at <https://github.com/perlancar/perl-DD>.
BUGS
Please report any bugs or feature requests on the bugtracker website
<https://rt.cpan.org/Public/Dist/Display.html?Name=DD>
When submitting a bug or request, please include a test-file or a patch
to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
XXX - basically the same thing but with different function names and
defaults. I happen to use "XXX" to mark todo items in source code, so I
prefer other names.
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2019, 2017 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.