Synchronize with CPAN's Data::Dumper 2.125
[p5sagit/p5-mst-13.2.git] / ext / Data-Dumper / Dumper.pm
index b716ff2..0eb8bf7 100644 (file)
@@ -9,7 +9,7 @@
 
 package Data::Dumper;
 
-$VERSION = '2.121_18';
+$VERSION = '2.125'; # Don't forget to set version and release date in POD!
 
 #$| = 1;
 
@@ -101,7 +101,7 @@ sub new {
   return bless($s, $c);
 }
 
-if ($] >= 5.006) {
+if ($] >= 5.008) {
   # Packed numeric addresses take less memory. Plus pack is faster than sprintf
   *init_refaddr_format = sub {};
 
@@ -231,11 +231,6 @@ sub Dumpperl {
       $name = "\$" . $s->{varname} . $i;
     }
 
-    # Ensure hash iterator is reset
-    if (ref($val) eq 'HASH') {
-        keys(%$val);
-    }
-
     my $valstr;
     {
       local($s->{apad}) = $s->{apad};
@@ -387,7 +382,7 @@ sub _dump {
        $out .= '\\' . $s->_dump($$val, "*{$name}");
     }
     elsif ($realtype eq 'ARRAY') {
-      my($v, $pad, $mname);
+      my($pad, $mname);
       my($i) = 0;
       $out .= ($name =~ /^\@/) ? '(' : '[';
       $pad = $s->{sep} . $s->{pad} . $s->{apad};
@@ -396,7 +391,7 @@ sub _dump {
        ($name =~ /^\\?[\%\@\*\$][^{].*[]}]$/) ? ($mname = $name) :
          ($mname = $name . '->');
       $mname .= '->' if $mname =~ /^\*.+\{[A-Z]+\}$/;
-      for $v (@$val) {
+      for my $v (@$val) {
        $sname = $mname . '[' . $i . ']';
        $out .= $pad . $ipad . '#' . $i if $s->{indent} >= 3;
        $out .= $pad . $ipad . $s->_dump($v, $sname);
@@ -429,6 +424,10 @@ sub _dump {
          $keys = [ sort keys %$val ];
        }
       }
+
+      # Ensure hash iterator is reset
+      keys(%$val);
+
       while (($k, $v) = ! $sortkeys ? (each %$val) :
             @$keys ? ($key = shift(@$keys), $val->{$key}) :
             () ) 
@@ -755,7 +754,7 @@ Data::Dumper - stringified perl data structures, suitable for both printing and
 =head1 DESCRIPTION
 
 Given a list of scalars or reference variables, writes out their contents in
-perl syntax. The references can also be objects.  The contents of each
+perl syntax. The references can also be objects.  The content of each
 variable is output in a single Perl statement.  Handles self-referential
 structures correctly.
 
@@ -1018,7 +1017,7 @@ Default is: C< =E<gt> >.
 $Data::Dumper::Maxdepth  I<or>  $I<OBJ>->Maxdepth(I<[NEWVAL]>)
 
 Can be set to a positive integer that specifies the depth beyond which
-which we don't venture into a structure.  Has no effect when
+we don't venture into a structure.  Has no effect when
 C<Data::Dumper::Purity> is set.  (Useful in debugger when we often don't
 want to see more than enough).  Default is 0, which means there is 
 no maximum depth. 
@@ -1298,7 +1297,7 @@ modify it under the same terms as Perl itself.
 
 =head1 VERSION
 
-Version 2.121  (Aug 24 2003)
+Version 2.125  (Aug  8 2009)
 
 =head1 SEE ALSO