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;
}
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
$evalarg = "\$^D = \$^D | \$DB::db_stop;\n$cmd"; &eval;
if ($onetimeDump) {
$onetimeDump = undef;
+ $onetimedumpDepth = undef;
} elsif ($term_pid == $$) {
print $OUT "\n";
}
The C<DB::OUT> filehandle is opened to F</dev/tty>, regardless of
where STDOUT may be redirected to.
-=item x expr
+=item x [maxdepth] expr
Evaluates its expression in list context and dumps out the result
in a pretty-printed fashion. Nested data structures are printed out
The output format is governed by multiple options described under
L<"Configurable Options">.
+If the C<maxdepth> is included, it must be a numeral I<N>; the value is
+dumped only I<N> levels deep, as if the C<dumpDepth> option had been
+deporarily set to I<N>.
+
=item V [pkg [vars]]
Display all (or some) variables in package (defaulting to C<main>)