This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Module::CoreList: Data from Sebastien Aperghis-Tramoni for perl
[perl5.git] / lib / dumpvar.pl
index f4a4399..474818a 100644 (file)
@@ -30,7 +30,8 @@ sub main::dumpValue {
   local $^W=0;
   (print "undef\n"), return unless defined $_[0];
   (print &stringify($_[0]), "\n"), return unless ref $_[0];
-  dumpvar::unwrap($_[0],0, $_[1]);
+  push @_, -1 if @_ == 1;
+  dumpvar::unwrap($_[0], 0, $_[1]);
 }
 
 # This one is good for variable names:
@@ -115,7 +116,7 @@ sub DumpElem {
            join("' '", @{$v}[0..$tArrayDepth]) . "'$shortmore";
   } else {
     print "$short\n";
-    unwrap($_[0],$_[1],$_[2]);
+    unwrap($_[0],$_[1],$_[2]) if ref $_[0];
   }
 }
 
@@ -176,7 +177,7 @@ sub unwrap {
 
     if ( $item_type eq 'HASH' ) { 
         # Hash ref or hash-based object.
-       @sortKeys = sort keys(%$v) ;
+       my @sortKeys = sort keys(%$v) ;
        undef $more ; 
        $tHashDepth = $#sortKeys ; 
        $tHashDepth = $#sortKeys < $hashDepth-1 ? $#sortKeys : $hashDepth-1