NAME

Clownfish::HashIterator - Hashtable Iterator.

SYNOPSIS

my $iter = Clownfish::HashIterator->new($hash);
while ($iter->next) {
    my $key   = $iter->get_key;
    my $value = $iter->get_value;
}

DESCRIPTION

CONSTRUCTORS

new

my $iter = Clownfish::HashIterator->new($hash);

Return a HashIterator for hash.

METHODS

next

my $bool = $hash_iterator->next();

Advance the iterator to the next key-value pair.

Returns: true if there’s another key-value pair, false if the iterator is exhausted.

get_key

my $string = $hash_iterator->get_key();

Return the key of the current key-value pair. It’s not allowed to call this method before next() was called for the first time or after the iterator was exhausted.

get_value

my $obj = $hash_iterator->get_value();

Return the value of the current key-value pair. It’s not allowed to call this method before next() was called for the first time or after the iterator was exhausted.

INHERITANCE

Clownfish::HashIterator isa Clownfish::Obj.