| Pangloss documentation | Contained in the Pangloss distribution. |
Pangloss::Term::Status - the status of a term.
use Pangloss::Term::Status;
my $status = new Pangloss::Term::Status();
$status->pending()
->notes( $text )
->creator( $user )
->date( time );
do { ... } if $status->is_pending();
This class represents a status associated with a term. It inherits from Pangloss::StoredObject::Common.
The following flags are available as class variables:
PENDING APPROVED REJECTED DEPRECATED
They are also available as a hash with lowercase keys via $class->status_codes.
internal method to set/get status code.
set this status code to one of the above. At present, multiple flags can only be set (ie: approved | deprecated) by setting $obj->code directly.
test if this status code is one of the above.
Steve Purkis <spurkis@quiup.com>
| Pangloss documentation | Contained in the Pangloss distribution. |
package Pangloss::Term::Status; use strict; use warnings::register; use base qw( Pangloss::StoredObject::Common ); our $VERSION = ((require Pangloss::Version), $Pangloss::VERSION)[1]; our $REVISION = (split(/ /, ' $Revision: 1.10 $ '))[2]; use constant PENDING => 1; use constant APPROVED => 2; use constant REJECTED => 4; use constant DEPRECATED => 8; sub status_codes { my $class = shift; my %codes = ( pending => $class->PENDING, approved => $class->APPROVED, rejected => $class->REJECTED, deprecated => $class->DEPRECATED, ); return wantarray ? %codes : \%codes; } sub code { my $self = shift; return $self->name(@_); } sub pending { my $self = shift; $self->code($self->PENDING); } sub approved { my $self = shift; $self->code($self->APPROVED); } sub rejected { my $self = shift; $self->code($self->REJECTED); } sub deprecated { my $self = shift; $self->code($self->DEPRECATED); } sub is_pending { my $self = shift; return ($self->code & $self->PENDING); } sub is_approved { my $self = shift; return ($self->code & $self->APPROVED); } sub is_rejected { my $self = shift; return ($self->code & $self->REJECTED); } sub is_deprecated { my $self = shift; return ($self->code & $self->DEPRECATED); } sub copy { my $self = shift; return $self->SUPER::copy( @_ ); } 1; __END__ #------------------------------------------------------------------------------