perlphx has asked for the wisdom of the Perl Monks concerning the following question:
Basically I am looking for the same thing, only robust (handling of circ. refs, blessed refs,...) and fast. There is the Data::Walk module, but I didn't really like it that much - it is not really an iterator (you provide a callback coderefs), and I don't like the way it iterates over hashes - it yields a value for a key and the next callback will yield the value. Does anybody know about something that would suit my needs? I looked all over the web and all I found was the Data::Walk module.my $iter = StructIterator->new ( struct => $my_struct, ); while ( $iter->next ) { my $value = $iter->yield; my $hash_key_or_array_index = $iter->index; my $current_depth = $iter->level; ## ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Iterating arbitrary data structure
by ikegami (Patriarch) on Aug 28, 2008 at 04:04 UTC | |
|
Re: Iterating arbitrary data structure
by Fletch (Bishop) on Aug 28, 2008 at 03:04 UTC | |
|
Re: Iterating arbitrary data structure
by gaal (Parson) on Aug 28, 2008 at 05:23 UTC | |
|
Re: Iterating arbitrary data structure
by Anonymous Monk on Aug 28, 2008 at 03:01 UTC |