summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-03-20 21:03:14 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-03-20 21:03:14 +0000
commitd918263624f69db4f9575643879bfa5b4453117e (patch)
treed20f4d796575cb91a7d0015a601af24c1ea6336c
parent36392fcf0bb917360f3e083a8d5bb2f65f72c346 (diff)
downloadperl-d918263624f69db4f9575643879bfa5b4453117e.tar.gz
make dumpvar.pl recognize emptyness in arrays (from Matthias Urlichs
<smurf@noris.de>); fix up duplicate code in Dumpvalue.pm p4raw-id: //depot/perl@5839
-rw-r--r--lib/Dumpvalue.pm12
-rw-r--r--lib/dumpvar.pl10
2 files changed, 15 insertions, 7 deletions
diff --git a/lib/Dumpvalue.pm b/lib/Dumpvalue.pm
index 5d3a9dafc2..617494aa15 100644
--- a/lib/Dumpvalue.pm
+++ b/lib/Dumpvalue.pm
@@ -227,9 +227,9 @@ sub unwrap {
if ($self->{compactDump} && !grep(ref $_, @{$v})) {
if ($#$v >= 0) {
$short = $sp . "0..$#{$v} " .
- join(" ",
- map {$self->stringify($_)} @{$v}[0..$tArrayDepth])
- . "$shortmore";
+ join(" ",
+ map {exists $v->[$_] ? $self->stringify $v->[$_] : "empty"} ($[..$tArrayDepth)
+ ) . "$shortmore";
} else {
$short = $sp . "empty array";
}
@@ -238,7 +238,11 @@ sub unwrap {
for my $num ($[ .. $tArrayDepth) {
return if $DB::signal and $self->{stopDbSignal};
print "$sp$num ";
- $self->DumpElem($v->[$num], $s);
+ if (exists $v->[$num]) {
+ $self->DumpElem($v->[$num], $s);
+ } else {
+ print "empty slot\n";
+ }
}
print "$sp empty array\n" unless @$v;
print "$sp$more" if defined $more ;
diff --git a/lib/dumpvar.pl b/lib/dumpvar.pl
index 4a3041a02b..51e9c88ea3 100644
--- a/lib/dumpvar.pl
+++ b/lib/dumpvar.pl
@@ -195,8 +195,8 @@ sub unwrap {
if ($#$v >= 0) {
$short = $sp . "0..$#{$v} " .
join(" ",
- map {stringify $_} @{$v}[0..$tArrayDepth])
- . "$shortmore";
+ map {exists $v->[$_] ? stringify $v->[$_] : "empty"} ($[..$tArrayDepth)
+ ) . "$shortmore";
} else {
$short = $sp . "empty array";
}
@@ -209,7 +209,11 @@ sub unwrap {
for $num ($[ .. $tArrayDepth) {
return if $DB::signal;
print "$sp$num ";
- DumpElem $v->[$num], $s;
+ if (exists $v->[$num]) {
+ DumpElem $v->[$num], $s;
+ } else {
+ print "empty slot\n";
+ }
}
print "$sp empty array\n" unless @$v;
print "$sp$more" if defined $more ;