CGI::Ex::Dump(3)

πŸ“¦
version 2.55 Β· 2 versions
, in fedora 43

πŸ’– 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