NAME
Data::Dump::HTML::Collapsible - Dump Perl data structures as HTML document with collapsible sections
VERSION
This document describes version 0.002 of Data::Dump::HTML::Collapsible (from Perl distribution Data-Dump-HTML-Collapsible), released on 2024-03-12.
SYNOPSIS
use Data::Dump::HTML::Collapsible; # exports dd(), can export dump()
dd [1, 2, 3];
DESCRIPTION
This module dumps Perl data structure to HTML document where you can expand and collapse nodes to drill down and roll up your data. It currently uses the <summary>
and <details>
HTML elements.
VARIABLES
$Data::Dump::HTML::Collapsible::OPT_PERL_VERSION
String, default: 5.010.
Set target Perl version. If you set this to, say 5.010
, then the dumped code will keep compatibility with Perl 5.10.0. This is used in the following ways:
passed to Regexp::Stringify
when dumping code references
For example, in perls earlier than 5.016, feature.pm does not understand:
no feature ':all';
so we replace it with:
no feature;
$Data::Dump::HTML::Collapsible::OPT_REMOVE_PRAGMAS
Bool, default: 0.
If set to 1, then pragmas at the start of coderef dump will be removed. Coderef dump is produced by B::Deparse and is of the form like:
sub { use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'switch', 'unicode_strings', 'unicode_eval'; $a <=> $b }
If you want to dump short coderefs, the pragmas might be distracting. You can turn turn on this option which will make the above dump become:
sub { $a <=> $b }
Note that without the pragmas, the dump might be incorrect.
$Data::Dump::HTML::Collapsible::::OPT_DEPARSE
Bool, default: 1.
Can be set to 0 to skip deparsing code. Coderefs will be dumped as sub{"DUMMY"}
instead, like in Data::Dump.
$Data::Dump::HTML::Collapsible::::OPT_STRINGIFY_NUMBERS
Bool, default: 0.
If set to true, will dump numbers as quoted string, e.g. 123 as "123" instead of 123. This might be helpful if you want to compute the hash of or get a canonical representation of data structure.
FUNCTIONS
dd
dump
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Data-Dump-HTML-Collapsible.
SOURCE
Source repository is at https://github.com/perlancar/perl-Data-Dump-HTML-Collapsible.
SEE ALSO
Other data structure dumpers to (collapsible) tree: Data::HTML::TreeDumper (doesn't handle recursion), Data::TreeDumper (Data::TreeDumper::Renderer::DHTML, Data::TreeDumper::Renderer::GTK), Data::Dumper::GUI.
Other data structure dumpers that outputs to HTML: Data::HTMLDumper, Data::Dumper::HTML, Data::Format::Pretty::HTML.
Other data structure dumpers: Data::Dumper, Data::Dump, Data::Dump::Color, Data::Dmp, Data::Printer.
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) 2024 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=Data-Dump-HTML-Collapsible
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.