Array::AsHash::Iterator - Iterator object for Array::AsHash
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.
Array::AsHash::each
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 Array::AsHash 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.
reset_each
Curtis "Ovid" Poe, <ovid@cpan.org>
<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?Queue=Array-AsHash. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-array-ashash@rt.cpan.org
Clone, Tie::IxHash, Array::AsHash, Class::Std (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.
To install Array::AsHash, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Array::AsHash
CPAN shell
perl -MCPAN -e shell install Array::AsHash
For more information on module installation, please visit the detailed CPAN module installation guide.