Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the YAML-LibYAML CPAN distribution.

Report information
The Basics
Id: 45259
Status: resolved
Priority: 0/
Queue: YAML-LibYAML

People
Owner: Nobody in particular
Requestors: EWATERS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.32
Fixed in: (no value)



Subject: Upon Dump(), all hashes within data have their 'each' iterator exhausted
See attached file. Very simply, after you call Dump() on a data structure, all hashes within that structure will have their 'each' iterator exhausted. This means that, if you call: my $str = Dump($data); while (my ($key, $value) = each %{ $data->{hash} }) { # do something } The 'do something' will never happen. A work around (not really) is to either a) avoid using 'each', or b) reset the iterator by calling 'keys' or 'values' on the hash. Eric Waters
Subject: test.pl
#!/usr/bin/perl use strict; use warnings; use YAML::XS qw(Dump Load); my %hash = ( eric => 'waters', subhash => { jason => 'hansen', }, ); my $str = Dump(\%hash); ## The following code won't run, as each will return undef ## FIXME!!! while (my ($key, $value) = each %hash) { print $key . ': '; if (ref($value)) { print "\n"; while (my ($skey, $svalue) = each %$value) { print $skey . ': ' . $svalue . "\n"; } } else { print $value . "\n"; } }
This seems to have been fixed at some point. Closing.