Data::Dump::Color(3)
π Data::Dump::Color π
okay bestie, so this is the manual page for Data::Dump::Color(3) β User Contributed Perl Documentation, no cap. it's like Data::Dump but make it fashion πβ¨
β¨ VERSION β¨
this doc is describing version 0.251 of Data::Dump::Color (from the Perl distribution Data-Dump-Color), which dropped on 2025-02-21. yes queen, fresh. π
πΈ SYNOPSIS πΈ
use it exactly like you'd use Data::Dump, fr fr:
use Data::Dump::Color; dd localtime;
that's it. that's the whole vibe. π
π¦ DESCRIPTION π¦
Sample screenshots:
this module is lowkey trying to be a drop-in replacement for Data::Dump β but it adds colors to your dumps (the whole point, obviously π¨) and also sprinkles in various visual aids inside the comments, like array/hash index, a depth indicator, and so on. it's giving glow-up.
for more deets, go look at Data::Dump. this documentation right here is specifically explaining what's different between this module and Data::Dump. iykyk.
π RESULTS π
by default, Data::Dump::Color shows the array index or hash pair sequence in the comments as a visual aid, like this:
[
"this", # [0]
"is", # [1]
"a", # [2]
"5-element", # [3]
"array", # [4]
{
0 => "with", # .{0}
1 => "an", # .{1}
2 => "extra", # .{2}
3 => "hash", # .{3}
4 => "at", # .{4}
5 => "the", # .{5}
16 => "end", # .{6}
}, # [5]
]
the [] and {} brackets tell you whether you're looking at indexes into an array or into a hash. and the dot prefixes mark the depth level. so . = one level deep, etc. periodt.
wanna turn this off? set $INDEX to 0 and watch the comments simply leave:
[
"this",
"is",
"a",
"5-element",
"array",
{
0 => "with",
1 => "an",
2 => "extra",
3 => "hash",
4 => "at",
5 => "the",
16 => "end",
},
]
clean. minimal. also valid. π«Ά
π VARIABLES π
all the $Data::Dump::* package variables from Data::Dump β like $Data::Dump::TRY_BASE64, etc β now live in the Data::Dump::Color namespace instead. so for example: $Data::Dump::Color::TRY_BASE64, etc. they moved out, got a new address, still iconic. π¦
and there are additional variables too:
$COLOR=> BOOL (default: undef) β whether to force-enable or disable color. if it's unset, then color output gets determined from theNO_COLORandCOLORenvironment variables, or from whether you're running in an interactive terminal (specifically when-t STDOUTis true). so like, it figures itself out, bestie.$COLOR_THEME=> str β pick a color theme. a theme is a module under theColorTheme::Data::Dump::Color::namespace or theColorTheme::namespace (you can use it with or without the namespace prefix, we're not picky). for example:Default256,Bright. π¨$INDEX=> BOOL (default: 1) β whether to add that array/hash index visual aid. defaults to on, because we do like nice things.$LENTHRESHOLD=> int (default: 500) β add the string length visual aid for hash key / hash value / array element whenever the length is at least this value. so 500+ characters? it gets flagged. π
π₯ FUNCTIONS π₯
only dd and ddx get exported by default. dump is there too, it's just not automatic β you gotta invite it. π
dd
ddx
dump
π§ FAQ π§
How do I turn off index comments?
set $Data::Dump::Color::INDEX to 0. boom, gone. β¨
How do I turn off colors?
okay so, colors are kinda the whole point of this module π but if you really must, you can set the environment variable COLOR to 0, or set $Data::Dump::Color::COLOR to 0. your call, bestie.
How do I customize colors?
create a color theme and give it a name under ColorTheme::Data::Dump::Color::*. peek at an existing color theme for an example β like ColorTheme::Data::Dump::Color::Default256. go forth and theme it up. π
π ENVIRONMENT π
DATA_DUMP_COLOR_THEME
set the color theme. the name will be searched under ColorTheme::Data::Dump::Color::* or ColorTheme::*. π
NO_COLOR
can be used to disable color. it takes precedence over the COLOR environment variable. see <https://no-color.org> for more details.
COLOR
if set, then it forces color output on or off. by default, color is only output when in an interactive terminal. this one is consulted when $COLOR is not set.
π HOMEPAGE π
please visit the project's homepage at <https://metacpan.org/release/Data-Dump-Color>. π
π SOURCE π
source repository is at <https://github.com/perlancar/perl-Data-Dump-Color>. go look, go star, go contribute.
β SEE ALSO β
Data::Dump, JSON::Color, YAML::Tiny::Color
π« AUTHOR π«
perlancar <perlancar@cpan.org>
π CONTRIBUTORS π
- Scott Baker <bakerscot@cpan.org>
- Steven Haryanto <stevenharyanto@gmail.com>
π CONTRIBUTING π
to contribute, you can send patches by email / via RT, or send pull requests on GitHub. we love a patch girlie. π«Ά
most of the time, you don't need to build the distribution yourself. you can simply modify the code, then test it via:
% prove -l
if you do want to build the distribution (like, 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) 2025 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-Color>.
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. help me help you bestie, receipts please. π
and that's the whole page, mwah π this was written against perl v5.42.0, and the page itself is dated 2025-07-25 β stay slay, stay colored πβ¨π
π¦ where this page comes from
- fedora 43: perl-Data-Dump-Color 0.251-2.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms