NAME

Puma::State::Core - Abstract base object for stateful hashes


SYNOPSIS

 use ibase Puma::State::Core;


DESCRIPTION

Puma::State::Core is an abstract class that is used as a base object by all other stateful objects. It provides the construction mechanisms for creating a tied hash/object and prototypes for data serialization and deserialization.


METHODS

new(Location => LOCATION, Context => CONTEXT, UID => UID)

The common usage for the constructor parameters are to use LOCATION as some form of URI to the data store, CONTEXT to determine the file or table name in the data store and UID as a unique identifier within the context.

It is common to use the name of the hash table variable as the CONTEXT (such as $session or $user) and the cookie (or a part of it) as the UID.

The values passed in from the constructor are stored as in the hash as _location, _context and _uid.

$obj->reserve(KEY => VALUE, ...)

Stateful objects have the ability to reserve words such that they will not appear when a listing of keys is requested. This is useful when a child object wants to store control data in the hash without it appearing in the seralized data.

The reserve() method will reserve any KEYs in the parameter list and initialize them with the associated VALUE.


INTERNALS

The Puma::State::Core object reserves a number of methods and veriables that should not be overridden or reused.

There's the usual hashtie methods:

   $obj->TIEHASH()
   $obj->STORE()
   $obj->FETCH()
   $obj->FIRSTKEY()
   $obj->NEXTKEY()
   $obj->EXISTS()
   $obj->DELETE()
   $obj->CLEAR()

and a method and data elements for managing content and reserved words:

   $obj->_reservedregex()
   $obj->{_reserved}
   $obj->{_content}


COPYRIGHT

Copyright (c) 2001, 2002 by Ingmar Ellenberger.

Distributed under The Artistic License. For the text of this license, see http://puma.site42.com/license.psp or read the file LICENSE in the root of the distribution.