Alister West

home is where your code is ...

Data::Dump

The problem with Data::Dumper is it doesn't have the good options on by default. Data::Dump has better defaults and tries to do some smart filtering for more readable output.

use Data::Dump qw/dump/;

print dump( a => {foo => [ 1 .. 1000 ]} );
# ("a", { foo => [1 .. 1000] })

Data::Dumper

There are several configurable options to Data::Dumper. To get nicely formatted output you need to set the following

use Data::Dumper;
$Data::Dumper::Terse     = 1; # 0 for !\n
$Data::Dumper::Indent    = 1;
$Data::Dumper::Sortkeys  = 1;
$Data::Dumper::Quotekeys = 1;

# Comment out Dumper output for TAP
$Data::Dumper::Pad = '# '; 

warn Dumper $my_obj;
# ... 

# Or as an object
warn Data::Dumper->new( [ \%param ] )   # Takes arrayref!
            ->Terse(1)->Sortkeys(1)->Indent(1)->Quotekeys(0)
            ->Pad('# ')
            ->Dump();
# ...
By Alister West