scratchpad
marinersk
<p>My <c>debug</c> module allows for dumping complex constructs easily, and it honors the debug flag so it can be enabled or disabled dynamically. There is also a <c>predebug-</c> variant which forces it on during development, and then global change/replace can change all <c>predebug</c> to <c>debug</c> and now it is production-ready, honoring the <c>--debug</c> flag.
<p>Here's a sample use case:</p>
<p>
<blockquote>
<code>
#!/usr/bin/perl
use strict;
use warnings;
use debug;
my %Gblhas = ( 'ABC' => 1, 'DEF' => [4, { 'JKL' => 7, 'MNO' => 8, 'PQR' => 9}, 6], 'GHI' => 3 );
&debug::predebugdumplist("\%Gblhas", \%Gblhas);
exit;
__END__
</code>
</blockquote>
</p>
<p>Yields:</p>
<p>
<blockquote>
<code>
S:\Steve\Dev\datadumper>perl datadumper-oldway.pl
%Gblhas (S:/Steve/Perl/debug.pm:887(990)):
[ABC] => [1]
[DEF] => [ARRAY(0x4ad6b0)]
[4]
[HASH(0x4ad4b8)]
[JKL] => [7]
[MNO] => [8]
[PQR] => [9]
[6]
[GHI] => [3]
S:\Steve\Dev\datadumper>
</code>
</blockquote>
</p>