Kurt Stephens > UMMF-0.25 > UMMF::Object::Extent

Download:
UMMF-0.25.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 1.003   Source   Latest Release: UMMF-1.02

NAME ^

UMMF::Object::Extent - Traces the extent of objects.

SYNOPSIS ^

  my $extent = UMML::Object::Extent->new();

  # Begin tracing extents of UML::__ObjectBase.
  UML::__ObjectBase->add___extent($extent);

  ... Create some objects that are subclasses of UML::__ObjectBase ...

  # Select all objects where $object->isaAttribute is true.
  my @attributes = $extent->object_where(sub { shift->isaAttribute });

  UML::__ObjectBase->remove___extent($extent);

DESCRIPTION ^

Extents are used to capture and manipulate collections of objects in a particular context.

For example: object databases are extents because they capture objects that are stored in databases; a CGI application session is an extent because it captures objects (i.e. values) to be stored and retrieved.

This class provides a base class for extents.

Although this class captures creation of objects, it uses weak references such that captured objects are still subjected to garbage collection.

USAGE ^

EXPORT ^

None exported.

AUTHOR ^

Kurt Stephens, kstephens@users.sourceforge.net 2003/10/05

SEE ALSO ^

UMMF

VERSION ^

$Revision: 1.3 $

METHODS ^

add_object

  $extent->add_object($obj);

Called when a Classifier creates a new object.

This will assign an id, unique to this Extent. The id can be used to retrieve the object using <$extent-object_by_id($id)>>.

Returns the assigned id.

object_where

  my @obj = $extent->object_where($predicate);

Returns all $objects where <$predicate-($object)>> is true.

Any object that have been garbage-collected will not be selected.

object_by_id

  my $obj = $extent->object_by_id($id);

Returns the object stored in this Extent that was assigned the <$id>.

If the object has been garbage collected, this will return undef.