Tangence::Object(3pm)
πΈ Tangence::Object πΈ
okay bestie, welcome to the Tangence::Object page β it's a Perl manual page from the 3pm section, and it's giving base class energy. Let's get into it π
β¨ NAME β¨
Tangence::Object β the base class for accessible objects in a Tangence server. periodt.
π DESCRIPTION π
So basically, this class is the base class for all the accessible objects living in a Tangence server. Every object that actually gets created and made accessible to clients is gonna be a subclass of this one β including the internally-created ones like Tangence::Registry. no cap.
Here's the tea though: you do not construct these objects directly by calling the new class method. nope. Instead, you use the Tangence::Registry to construct one. that's the way. π«Ά
π METHODS π
π¦ destroy
$obj->destroy;
This one requests that the object destroy itself, and it lets every client that knows about it know what's happening. Once all of them report back that they've dropped the object, then it actually gets deconstructed for real. it's a whole process, bestie.
β οΈ Do not confuse this with Perl's own DESTROY method. They are literally not the same thing, iykyk.
π¦ id
$id = $obj->id;
Hands you back the object's Tangence ID number. iconic little number tbh.
π¦ describe
$description = $obj->describe;
Returns a textual description of the object β this one's for internal debugging purposes. Subclasses are encouraged to override this method and return something more descriptive within their own domain of interest. go off, subclass π
π¦ registry
$registry = $obj->registry;
Returns the Tangence::Registry that constructed this object. the origin story, if you will.
π¦ class
$class = $obj->class;
Returns the Tangence::Meta::Class object that represents the class of this object. main character identification β¨
π¦ can_method
$method = $obj->can_method( $name );
Returns the Tangence::Meta::Method object representing the named method β or undef if no such method exists. sad but honest.
π¦ can_event
$event = $obj->can_event( $name );
Returns the Tangence::Meta::Event object representing the named event β or undef if there's no such event. π₯²
π¦ can_property
$property = $obj->can_property( $name );
Returns the Tangence::Meta::Property object representing the named property β or undef if that property doesn't exist. we move.
π¦ fire_event
$obj->fire_event( $event, @args );
Fires the named event on the object π₯. Every single event subscription function gets invoked with the given arguments. it's a whole group chat notification moment.
π¦ subscribe_event
$id = $obj->subscribe_event( $event, $callback );
Subscribes an event-handling callback CODE ref to the named event. When the event gets fired by fire_event, this callback is gonna be invoked β and it gets passed the object reference plus the event's arguments:
$callback->( $obj, @args );
Returns an opaque ID value that you can use to remove this subscription later by calling unsubscribe_event. keep that ID safe bestie, it's your receipt π§Ύ
π¦ unsubscribe_event
$obj->unsubscribe_event( $event, $id );
Removes an event-handling callback that you previously registered with subscribe_event. bye bye π
π¦ watch_property
$id = $obj->watch_property( $prop, %callbacks );
Watches a named property for changes, registering a whole lil set of callback functions to be invoked when the property changes in certain ways. The exact set of callbacks you need depends on the dimension of the property you're watching. so pay attention, okay?
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 β yes, there's another way, bestie β a single callback can be installed that gets invoked after any change of the property, and it's passed the whole new value:
$on_updated->( $obj, $value );
Returns an opaque ID value that you can use to remove this watch by calling unwatch_property. π
π¦ unwatch_property
$obj->unwatch_property( $prop, $id );
Removes the set of callback functions that you previously registered with watch_property. closure, but make it cute πΈ
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β the icon who wrote all this π
and that's the whole page, bestie π«Ά this was Tangence::Object(3pm) from the User Contributed Perl Documentation, running on perl v5.40.0, dated 2024-09-13. slay, bye πβ¨
π¦ where this page comes from
- ubuntu resolute: libtangence-perl 0.33-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtangence-perl 0.33-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms