Pangloss::Collection - base class for collections in Pangloss.
# abstract - cannot be used directly use base qw( Pangloss::Collection ); # read on...
This class is a simple OO wrapper around a perl Hash. Perhaps a better name for it would be Collection::Map. It should help make storing collections of objects in Pixie easier.
Items stored in these collections should inherit from Pangloss::Collection::Item.
as in keys(). uses wantarray for Petal compliancy.
keys()
as in values(). uses wantarray for Petal compliancy.
values()
synonym for $obj->values().
returns $obj->values() sorted alphabetically by key.
get an iterator code ref for this collection, can be used as such:
while (my $next_val = $iterator->()) { ... }
useful for large collections.
as in exists().
exists()
get the value associated with $key. throws an error if $key does not exist.
add values to this collection. looks up keys for these values with $obj->get_values_key(). throws an error if values already exists. returns this object.
remove keys and/or values from this collection. throws an error if a key does not exist. returns this object.
gets $value->key() if $value is blessed, or returns $value.
returns a new object containing a shallow copy of this collection. (ie: objects in the clone's collection are the same)
returns a new object containing a deep copy of this collection. (ie: objects in the clone's collection are cloned)
Override the following methods:
abstract. indicates a Pangloss::Error should be thrown.
Steve Purkis <spurkis@quiup.com>
Pangloss, Pangloss::Collection::Item, OpenFrame::WebApp::Error::Abstract
To install Pangloss, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pangloss
CPAN shell
perl -MCPAN -e shell install Pangloss
For more information on module installation, please visit the detailed CPAN module installation guide.