CGI::Ex::Dump(3)
π CGI::Ex::Dump β bestie's fave debug utility π
okay so like. CGI::Ex::Dump is the manual page we're doing here (it lives in the User Contributed Perl Documentation part of the world, in case you were wondering). It's a debug utility. That's literally what it says on the tin. And it is so good. Let's get into it π¦
β¨ VERSION β¨
we are on version 2.55. periodt.
πΈ SYNOPSIS πΈ
okay bestie, here's the vibe. Copy this exactly, don't freestyle:
use CGI::Ex::Dump; # auto imports dex, dex_warn, dex_text and others
my $hash = {
foo => ['a', 'b', 'Foo','a', 'b', 'Foo','a', 'b', 'Foo','a'],
};
dex $hash; # or dex_warn $hash;
dex;
dex "hi";
dex $hash, "hi", $hash;
dex \@INC; # print to STDOUT, or format for web if $ENV{REQUEST_METHOD}
dex_warn \@INC; # same as dex but to STDOUT
print FOO dex_text \@INC; # same as dex but return dump
# ALSO #
use CGI::Ex::Dump qw(debug);
debug; # same as dex
no cap, that's the whole flex. β¨
π DESCRIPTION π
So. This module takes the base Data::Dumper that ships with the distribution, and gives it a whole glow-up β nicer formatting, cuter output β and the best part? You can call it just about anytime during execution. Mid-script. Mid-chaos. Whenever. It's giving main character energy fr fr. π
If you call &CGI::Ex::set_deparse() it will allow for dumped output of subroutines β but only if available. iykyk.
Also, this is a thing you can literally just run in a terminal:
perl -e 'use CGI::Ex::Dump; dex "foo";'
See also Data::Dumper β that's the origin story, go show it some love. π«Ά
And heads up: setting any of the Data::Dumper globals will alter the output. Yeah. All of them. The output is lowkey at their mercy.
π SUBROUTINES π
π dex, debug
Prints out pretty output to STDOUT. And if you're on the web? It gets formatted for the web. Automatic. Iconic.
π dex_warn
Prints to STDERR. Same energy, different stream.
π dex_text
Returns the text as a scalar. Like, hands it back to you instead of yelling it into the void.
π ctrace
Caller trace, returned as an arrayref. Perfect for stuff like debug ctrace. π΅οΈββοΈ
Little caveat bestie: this one does require at least perl 5.8.0's Carp. No workarounds, that's just the deal.
π on, off
Turns calls to routines on or off. Default is to be on β like, it's on until you tell it otherwise. π
π LICENSE π
This module may distributed under the same terms as Perl itself.
(Yes, that's the original wording, keeping it character for character, don't @ me π)
π AUTHORS π
Paul Seamons <perl at seamons dot com>
and that's the whole page bestie!! π this was CGI::Ex::Dump(3), shipped in perl v5.42.0 and dated 2025-07-25. go forth and dex everything you love β¨ππ¦
π¦ where this page comes from
- fedora 43: perl-CGI-Ex 2.55-6.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