- $id = $obj->id
- $description = $obj->describe
- $registry = $obj->registry
- $class = $obj->class
- $method = $obj->can_method( $name )
- $event = $obj->can_event( $name )
- $property = $obj->can_property( $name )
- $obj->fire_event( $event, @args )
- $id = $obj->subscribe_event( $event, $callback )
- $obj->unsubscribe_event( $event, $id )
- $id = $obj->watch_property( $prop, %callbacks )
- $obj->unwatch_property( $prop, $id )
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
Returns the object's
Tangence ID number
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
Returns the Tangence::Registry that constructed this object.
Returns the Tangence::Meta::Class object representing the class of this object.
Returns the Tangence::Meta::Method object representing the named method, or
undef if no such method exists.
Returns the Tangence::Meta::Event object representing the named event, or
undef if no such event exists.
Returns the Tangence::Meta::Property object representing the named property, or
undef if no such property exists.
Fires the named event on the object. Each event subscription function will be invoked with the given arguments.
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
Removes an event-handling callback previously registered with
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
Removes the set of callback functions previously registered with
Paul Evans <email@example.com>