X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fperl5db.pl;h=4e7ff9e28a533a8e19a30e484e8511ee7ee2eb17;hb=6b14ceb78325f07f9267f4d0b22adc748311a9a0;hp=c1996b08527f28d329e4763da175ac9162458a4a;hpb=4865a36daa1b2556054c8fc5515c6d3ea3656997;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/perl5db.pl b/lib/perl5db.pl index c1996b0..4e7ff9e 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -23,8 +23,13 @@ sub eval { if ($at) { print $OUT $at; } elsif ($onetimeDump) { - dumpit($OUT, \@res) if $onetimeDump eq 'dump'; - methods($res[0]) if $onetimeDump eq 'methods'; + if ($onetimeDump eq 'dump') { + local $option{dumpDepth} = $onetimedumpDepth + if defined $onetimedumpDepth; + dumpit($OUT, \@res); + } elsif ($onetimeDump eq 'methods') { + methods($res[0]) ; + } } @res; } @@ -328,7 +333,8 @@ $trace = $signal = $single = 0; # Uninitialized warning suppression # (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 @@ -820,7 +826,12 @@ EOP select ($savout); next CMD; }; $cmd =~ s/^x\b/ / && do { # So that will be evaled - $onetimeDump = 'dump'; }; + $onetimeDump = 'dump'; + # handle special "x 3 blah" syntax + if ($cmd =~ s/^\s*(\d+)(?=\s)/ /) { + $onetimedumpDepth = $1; + } + }; $cmd =~ s/^m\s+([\w:]+)\s*$/ / && do { methods($1); next CMD}; $cmd =~ s/^m\b/ / && do { # So this will be evaled @@ -1521,6 +1532,7 @@ EOP $evalarg = "\$^D = \$^D | \$DB::db_stop;\n$cmd"; &eval; if ($onetimeDump) { $onetimeDump = undef; + $onetimedumpDepth = undef; } elsif ($term_pid == $$) { print $OUT "\n"; } @@ -1826,7 +1838,10 @@ sub dumpit { 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"; } @@ -2184,7 +2199,7 @@ sub parse_options { # 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) {