local $^W=0;
(print "undef\n"), return unless defined $_[0];
(print &stringify($_[0]), "\n"), return unless ref $_[0];
- dumpvar::unwrap($_[0],0);
+ dumpvar::unwrap($_[0],0, $_[1]);
}
# This one is good for variable names:
join("' '", @{$v}[0..$tArrayDepth]) . "'$shortmore";
} else {
print "$short\n";
- unwrap($_[0],$_[1]);
+ unwrap($_[0],$_[1],$_[2]);
}
}
return if $DB::signal;
local($v) = shift ;
local($s) = shift ; # extra no of spaces
+ local($m) = shift ; # maximum recursion depth
+ return if $m == 0;
local(%v,@v,$sp,$value,$key,@sortKeys,$more,$shortmore,$short) ;
local($tHashDepth,$tArrayDepth) ;
return if $DB::signal;
$value = $ {$v}{$key} ;
print "$sp", &stringify($key), " => ";
- DumpElem $value, $s;
+ DumpElem $value, $s, $m-1;
}
print "$sp empty hash\n" unless @sortKeys;
print "$sp$more" if defined $more ;
return if $DB::signal;
print "$sp$num ";
if (exists $v->[$num]) {
- DumpElem $v->[$num], $s;
+ DumpElem $v->[$num], $s, $m-1;
} else {
print "empty slot\n";
}
print "$sp$more" if defined $more ;
} elsif ( UNIVERSAL::isa($v, 'SCALAR') or ref $v eq 'REF' ) {
print "$sp-> ";
- DumpElem $$v, $s;
+ DumpElem $$v, $s, $m-1;
} elsif ( UNIVERSAL::isa($v, 'CODE') ) {
print "$sp-> ";
dumpsub (0, $v);
# (local $^W cannot help - other packages!).
$inhibit_exit = $option{PrintRet} = 1;
-@options = qw(hashDepth arrayDepth DumpDBFiles DumpPackages DumpReused
+@options = qw(hashDepth arrayDepth dumpDepth
+ DumpDBFiles DumpPackages DumpReused
compactDump veryCompact quote HighBit undefPrint
globPrint PrintRet UsageOnly frame AutoTrace
TTY noTTY ReadLine NonStop LineInfo maxTraceLen
do 'dumpvar.pl';
}
if (defined &main::dumpValue) {
- &main::dumpValue(shift);
+ my $v = shift;
+ my $maxdepth = shift || $option{dumpDepth};
+ $maxdepth = -1 unless defined $maxdepth; # -1 means infinite depth
+ &main::dumpValue($v, $maxdepth);
} else {
print $OUT "dumpvar.pl not available.\n";
}
# too dangerous to let intuitive usage overwrite important things
# defaultion should never be the default
my %opt_needs_val = map { ( $_ => 1 ) } qw{
- arrayDepth hashDepth LineInfo maxTraceLen ornaments windowSize
+ dumpDepth arrayDepth hashDepth LineInfo maxTraceLen ornaments windowSize
pager quote ReadLine recallCommand RemotePort ShellBang TTY
};
while (length) {
Print only first N elements ('' for all).
+=item C<dumpDepth>
+
+Limit recursion depth to N levels when dumping structures.
+Negative values are interpreted as infinity. Default: infinity.
+
=item C<compactDump>, C<veryCompact>
Change the style of array and hash output. If C<compactDump>, short array