
EO::Hash - hash type collection

use EO::Hash; $hash = EO::Hash->new(); $hash->at( 'foo', 'bar' ); my $thing = $hash->at( 'foo' ); print "ok\n" if $thing->has( 'foo' ); $thing->delete( 'foo' ); my $keys = $hash->keys; my $vals = $hash->values; my $count = $hash->count; my %hash = %$hash;

EO::Hash is an OO wrapper around Perl's hash type. Objects of the hash class will act as a normal hash outside of any class that does not have an 'EO::' prefix.

EO::Hash inherits from EO::Collection.

EO::Hash provides the following constructors beyond those that the parent class provides:
Prepares a EO::Hash object that has all the elements contained in HASHREF.

Returns true if the key exists inside the hash
Adds a pair to the hash.
Returns an EO::Pair object for the key value pair at KEY.
Runs the coderef CODE for each pair in the EO::Hash object. It passes CODE the EO::Pair object as both its first argument and as $_. CODE must return a pair object. The do method returns an EO::Hash which has all the pairs that are returned from CODE.
Runs the coderef CODE for each pair in the EO::Hash object. It passes CODE the EO::Pair object as both its first argument and as $_. If the result of running the code is true, then the pair is added to a new EO::Hash object which is returned.
Gets and sets key value pairs. KEY should always be a string. If provided VALUE will be placed in the EO::Hash object at the key KEY.
Deletes a key/value pair, indexed by key, from the EO::Hash object.
Returns an integer representing the number of key/value pairs in the EO::Hash object.
Returns a Perl hash.
In scalar context returns an EO::Array object of keys in the EO::Hash. In list context it returns a Perl array of keys in the EO::Hash.
In scalar context returns an EO::Array object of values in the EO::Hash. In list context it returns a Perl array of values in the EO::Hash.


James A. Duncan <jduncan@fotango.com>

Copyright 2003 Fotango Ltd. All Rights Reserved.
This module is released under the same terms as Perl itself.