This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add U+0085, U+2028, and U+2029 to \s under Unicode.
[perl5.git] / lib / dumpvar.pl
index c727818..c918f2b 100644 (file)
@@ -187,7 +187,7 @@ sub unwrap {
        $tArrayDepth = $#{$v} ; 
        undef $more ; 
        $tArrayDepth = $#{$v} < $arrayDepth-1 ? $#{$v} : $arrayDepth-1 
-         unless  $arrayDepth eq '' ; 
+         if defined $arrayDepth && $arrayDepth ne '';
        $more = "....\n" if $tArrayDepth < $#{$v} ; 
        $shortmore = "";
        $shortmore = " ..." if $tArrayDepth < $#{$v} ;
@@ -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 ;  
@@ -361,7 +365,9 @@ sub main::dumpvar {
       return if $DB::signal;
       next if @vars && !grep( matchvar($key, $_), @vars );
       if ($usageOnly) {
-       globUsage(\$val, $key) unless $package eq 'dumpvar' and $key eq 'stab';
+       globUsage(\$val, $key)
+         if ($package ne 'dumpvar' or $key ne 'stab')
+            and ref(\$val) eq 'GLOB';
       } else {
        dumpglob(0,$key, $val);
       }