Tangence::Object - base class for accessible objects in a
This class acts as a base class for the accessible objects in a Tangence server. All the objects actually created and made accessible to clients will be subclasses of this one, including internally-created objects such as Tangence::Registry.
These objects are not directly constructed by calling the
new class method; instead the
Tangence::Registry should be used to construct one.
Requests that the object destroy itself, informing all clients that are aware of it. Once they all report that they have dropped the object, the object is deconstructed for real.
Not to be confused with Perl's own
$id = $obj->id
Returns the object's
Tangence ID number
$description = $obj->describe
Returns a textual description of the object, for internal debugging purposes. Subclasses are encouraged to override this method to return something more descriptive within their domain of interest
$registry = $obj->registry
Returns the Tangence::Registry that constructed this object.
$class = $obj->class
Returns the Tangence::Meta::Class object representing the class of this object.
$method = $obj->can_method( $name )
Returns the Tangence::Meta::Method object representing the named method, or
undef if no such method exists.
$event = $obj->can_event( $name )
Returns the Tangence::Meta::Event object representing the named event, or
undef if no such event exists.
$property = $obj->can_property( $name )
Returns the Tangence::Meta::Property object representing the named property, or
undef if no such property exists.
$obj->fire_event( $event, @args )
Fires the named event on the object. Each event subscription function will be invoked with the given arguments.
$id = $obj->subscribe_event( $event, $callback )
Subscribes an event-handling callback CODE ref to the named event. When the event is fired by
fire_event this callback will be invoked, being passed the object reference and the event's arguments.
$callback->( $obj, @args )
Returns an opaque ID value that can be used to remove this subscription by calling
$obj->unsubscribe_event( $event, $id )
Removes an event-handling callback previously registered with
$id = $obj->watch_property( $prop, %callbacks )
Watches a named property for changes, registering a set of callback functions to be invoked when the property changes in certain ways. The set of callbacks required depends on the dimension of the property being watched.
For all property types:
$on_set->( $obj, $value )
For hash properties:
$on_add->( $obj, $key, $value ) $on_del->( $obj, $key )
For queue properties:
$on_push->( $obj, @values ) $on_shift->( $obj, $count )
For array properties:
$on_push->( $obj, @values ) $on_shift->( $obj, $count ) $on_splice->( $obj, $index, $count, @values ) $on_move->( $obj, $index, $delta )
For objset properties:
$on_add->( $obj, $added_object ) $on_del->( $obj, $deleted_object_id )
Alternatively, a single callback may be installed that is invoked after any change of the property, being passed the new value entirely:
$on_updated->( $obj, $value )
Returns an opaque ID value that can be used to remove this watch by calling
$obj->unwatch_property( $prop, $id )
Removes the set of callback functions previously registered with
Paul Evans <firstname.lastname@example.org>