Acme-CPANModules-DumpingDataForDebugging
view release on metacpan or search on metacpan
NAME
Acme::CPANModules::DumpingDataForDebugging - List of modules and tips
when dumping data structures for debugging
VERSION
This document describes version 0.002 of
Acme::CPANModules::DumpingDataForDebugging (from Perl distribution
Acme-CPANModules-DumpingDataForDebugging), released on 2023-10-29.
DESCRIPTION
This list catalogs some of the modules you can you to dump your data
structures for debugging purposes, so the modules will be judged mostly
by the appropriateness of its output for human viewing (instead of other
criteria like speed, footprint, etc).
ACME::CPANMODULES ENTRIES
Data::Dumper
Author: NWCLARK <https://metacpan.org/author/NWCLARK>
Everybody knows this module and it's core so sometimes it's the only
appropriate choice. However, the default setting is not really
optimized for viewing by human. I suggest you tweak these before
dumping your data:
* Set $Data::Dumper::Useqq to 1.
By default, Data::Dumper quotes strings using single-quotes and does
not quote things like "\n" and "\b" making it difficult to spot
special characters.
Data::Dump
Author: GARU <https://metacpan.org/author/GARU>
A data dumper that produces nicer Perl code output, with features
like vertical alignment of "=>" when dumping hashes, compacting
sequences like 1,2,3,4,5,6 to 1..6, compacting repeating characters
in string like "ccccccccccccccccccccc" to ("c" x 21), and so on.
It tries harder to produce Perl code that generates the original
data structure, particularly with circular references. But with
interlinked references like trees, Data::Dumper might be more
helpful in showing you which references get mentioned where. For
example this data:
$tree = {children=>[{children=>[{}]}, {children=>[]}]};
$tree->{children}[0]{parent}=$tree;
$tree->{children}[1]{parent}=$tree;
$tree->{children}[0]{children}[0]{parent} = $tree->{children}[0];
Data::Dump will produce:
do {
my $a = {
children => [
{ children => [{ parent => 'fix' }], parent => 'fix' },
{ children => [], parent => 'fix' },
],
};
$a->{children}[0]{children}[0]{parent} = $a->{children}[0];
$a->{children}[0]{parent} = $a;
$a->{children}[1]{parent} = $a;
$a;
}
while Data::Dumper will produce:
$VAR1 = {
'children' => [
{
'children' => [
{
'parent' => $VAR1->{'children'}[0]
}
],
'parent' => $VAR1
},
{
'parent' => $VAR1,
'children' => []
}
]
};
Data::Dump::Color
Author: PERLANCAR <https://metacpan.org/author/PERLANCAR>
A modification to Data::Dump which adds color (and color theme)
support, as well as other visual aids like depth and array
index/hash pair count indicator. It's usually my go-to module for
debugging.
Data::Dumper::Compact
Author: MSTROUT <https://metacpan.org/author/MSTROUT>
Alternatively you can use the cpanmodules CLI (from App::cpanmodules
distribution):
% cpanmodules ls-entries DumpingDataForDebugging | cpanm -n
or Acme::CM::Get:
% perl -MAcme::CM::Get=DumpingDataForDebugging -E'say $_->{module} for @{ $LIST->{entries} }' | cpanm -n
or directly:
% perl -MAcme::CPANModules::DumpingDataForDebugging -E'say $_->{module} for @{ $Acme::CPANModules::DumpingDataForDebugging::LIST->{entries} }' | cpanm -n
This Acme::CPANModules module also helps lcpan produce a more meaningful
result for "lcpan related-mods" command when it comes to finding related
modules for the modules listed in this Acme::CPANModules module. See
App::lcpan::Cmd::related_mods for more details on how "related modules"
are found.
HOMEPAGE
Please visit the project's homepage at
<https://metacpan.org/release/Acme-CPANModules-DumpingDataForDebugging>.
SOURCE
Source repository is at
<https://github.com/perlancar/perl-Acme-CPANModules-DumpingDataForDebugg
ing>.
SEE ALSO
Acme::CPANModules - about the Acme::CPANModules namespace
cpanmodules - CLI tool to let you browse/view the lists
AUTHOR
perlancar <perlancar@cpan.org>
CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull
requests on GitHub.
Most of the time, you don't need to build the distribution yourself. You
can simply modify the code, then test via:
% prove -l
If you want to build the distribution (e.g. to try to install it locally
on your system), you can install Dist::Zilla,
Dist::Zilla::PluginBundle::Author::PERLANCAR,
Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two
other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps
required beyond that are considered a bug and can be reported to me.
COPYRIGHT AND LICENSE
This software is copyright (c) 2023, 2020 by perlancar
<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.
BUGS
Please report any bugs or feature requests on the bugtracker website
<https://rt.cpan.org/Public/Dist/Display.html?Name=Acme-CPANModules-Dump
ingDataForDebugging>
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.
( run in 2.346 seconds using v1.01-cache-2.11-cpan-2398b32b56e )