Pangloss::Categories - a collection of Pangloss categories.


Pangloss documentation Contained in the Pangloss distribution.

Index


Code Index:

NAME

Top

Pangloss::Categories - a collection of Pangloss categories.

SYNOPSIS

Top

  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;
      ...
  }

DESCRIPTION

Top

This class contains a collection of Pangloss::Category objects. It inherits its interface from Pangloss::Collection.

The collection is keyed on $category->name().

METHODS

Top

@names = $obj->names

synonym for $obj->keys()

AUTHOR

Top

Steve Purkis <spurkis@quiup.com>

SEE ALSO

Top

Pangloss, Pangloss::Collection, Pangloss::Category, Pangloss::Category::Error


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__

#------------------------------------------------------------------------------