This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make dumpvar.pl recognize emptyness in arrays (from Matthias Urlichs
[perl5.git] / lib / dumpvar.pl
index 4a3041a..51e9c88 100644 (file)
@@ -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 ;