Array::AsHash::Iterator - Iterator object for the Array::AsHash manpage
Version 0.02
my $iterator = Array::AsHash->new({array => \@array})->each;
while (my ($key, $value) = $iterator->next) {
print "First \n" if $iterator->first;
print "$key : $value\n";
print "Last \n" if $iterator->last;
}
This is the iterator returned by the Array::AsHash::each method. Do not
use directly.
None.
my $iterator = Array::AsHash::Iterator->new({ parent => $array_as_hash_object, iterator => $array_as_hash_object_internal_iterator, });
while (my ($key, $value) = $iterator->next) { ... }
Returns the next key/value pair in the iterator.
if ($iterator->first) { ... }
Returns true after when we are on the first key/value pair (after it has been returned) and before we have returned the second key/value pair.
if ($iterator->last) { ... }
Returns true after we have returned the last key/value pair.
my $parent = $iterator->parent;
Returns the parent the Array::AsHash manpage object used to create the iterator.
$iterator->reset_each;
As with a regular hash, if you do not iterate over all of the data, the internal
pointer will be pointing at the next key/value pair to be returned. If you need
to restart from the beginning, call the reset_each method.
Curtis "Ovid" Poe, <ovid@cpan.org>
Please report any bugs or feature requests to
bug-array-ashash@rt.cpan.org, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
the Clone manpage, the Tie::IxHash manpage, the Array::AsHash manpage, the Class::Std manpage (how this module is implemented).
Copyright 2005 Curtis "Ovid" Poe, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.