NAME
Array::AsHash::Iterator - Iterator object for Array::AsHash
VERSION
Version 0.02
SYNOPSIS
my
$iterator
= Array::AsHash->new({
array
=> \
@array
})->
each
;
while
(
my
(
$key
,
$value
) =
$iterator
->
next
) {
"First \n"
if
$iterator
->first;
"$key : $value\n"
;
"Last \n"
if
$iterator
->
last
;
}
DESCRIPTION
This is the iterator returned by the Array::AsHash::each
method. Do not use directly.
EXPORT
None.
METHODS
new
my
$iterator
= Array::AsHash::Iterator->new({
parent
=>
$array_as_hash_object
,
iterator
=>
$array_as_hash_object_internal_iterator
,
});
next
while
(
my
(
$key
,
$value
) =
$iterator
->
next
) {
...
}
Returns the next key/value pair in the iterator.
first
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.
last
if
(
$iterator
->
last
) {
...
}
Returns true after we have returned the last key/value pair.
parent
my
$parent
=
$iterator
->parent;
Returns the parent Array::AsHash object used to create the iterator.
reset_each
$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.
AUTHOR
Curtis "Ovid" Poe, <ovid@cpan.org>
BUGS
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.
SEE ALSO
Clone, Tie::IxHash, Array::AsHash, Class::Std (how this module is implemented).
COPYRIGHT & LICENSE
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.