| Pangloss documentation | Contained in the Pangloss distribution. |
Pangloss::Categories - a collection of Pangloss categories.
use Pangloss::Categories;
my $categories = new Pangloss::Categories();
try {
my $category = $categories->get( $name );
$categories->add( $category );
$categories->remove( $category );
do { ... } foreach ( $categories->list );
} catch Pangloss::Category::Error with {
my $e = shift;
...
}
This class contains a collection of Pangloss::Category objects. It inherits its interface from Pangloss::Collection.
The collection is keyed on $category->name().
synonym for $obj->keys()
Steve Purkis <spurkis@quiup.com>
| Pangloss documentation | Contained in the Pangloss distribution. |
package Pangloss::Categories; use strict; use warnings::register; use Error; use Pangloss::Category; use Pangloss::Category::Error; use Pangloss::StoredObject::Error; use base qw( Pangloss::Collection ); our $VERSION = ((require Pangloss::Version), $Pangloss::VERSION)[1]; our $REVISION = (split(/ /, ' $Revision: 1.5 $ '))[2]; sub names { return shift->keys; } sub error_key_nonexistent { my $self = shift; my $name = shift; throw Pangloss::Category::Error(flag => eNonExistent, name => $name); } sub error_key_exists { my $self = shift; my $name = shift; throw Pangloss::Category::Error(flag => eExists, name => $name); } 1; __END__ #------------------------------------------------------------------------------