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;
}
# (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
dieLevel($dieLevel);
signalLevel($signalLevel);
-&pager(
- (defined($ENV{PAGER})
- ? $ENV{PAGER}
- : ($^O eq 'os2'
- ? 'cmd /c more'
- : 'more'))) unless defined $pager;
+pager(
+ defined $ENV{PAGER} ? $ENV{PAGER} :
+ eval { require Config } &&
+ defined $Config::Config{pager} ? $Config::Config{pager}
+ : 'more'
+ ) unless defined $pager;
setman();
&recallCommand("!") unless defined $prc;
&shellBang("!") unless defined $psh;
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";
}
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) {