Tangence::Client(3pm) | User Contributed Perl Documentation | Tangence::Client(3pm) |
"Tangence::Client" - mixin class for building a "Tangence" client
This class is a mixin, it cannot be directly constructed
package Example::Client; use base qw( Base::Client Tangence::Client ); sub connect { my $self = shift; $self->SUPER::connect( @_ ); $self->tangence_connected; wait_for { defined $self->rootobj }; } sub tangence_write { my $self = shift; $self->write( $_[0] ); } sub on_read { my $self = shift; $self->tangence_readfrom( $_[0] ); } package main; my $client = Example::Client->new; $client->connect( "server.location.here" ); my $rootobj = $client->rootobj;
This module provides mixin to implement a "Tangence" client connection. It should be mixed in to an object used to represent a single connection to a server. It provides a central location in the client to store object proxies, including to the root object and the registry, and coordinates passing messages between the server and the object proxies it contains.
This is a subclass of Tangence::Stream which provides implementations of the required "handle_request_" methods. A class mixing in "Tangence::Client" must still provide the "tangence_write" method required for sending data to the server.
For an example of a class that uses this mixin, see Net::Async::Tangence::Client.
The following methods are provided by this mixin.
$rootobj = $client->rootobj
Returns a Tangence::ObjectProxy to the server's root object
$registry = $client->registry
Returns a Tangence::ObjectProxy to the server's object registry if one has been received, or "undef" if not.
This method is now deprecated in favour of "get_registry". Additionally note that currently the client will attempt to request the registry at connection time, but a later version of this module will stop doing that, so users who need access to it should call "get_registry".
$registry = $client->get_registry->get
Returns a Future that will yield a Tangence::ObjectProxy to the server's registry object.
Note that not all servers may permit access to the registry.
$client->tangence_connected( %args )
Once the base connection to the server has been established, this method should be called to perform the initial work of requesting the root object and the registry.
It takes the following named arguments:
$on_root->( $rootobj )
$on_registry->( $registry )
Note that in the case that the server does not permit access to the registry or an error occurs while requesting it, this is invoked with an empty list.
$on_registry->()
These methods are intended for implementation classes to override.
$f = $client->new_future
Returns a new Future instance for basing asynchronous operations on.
Paul Evans <leonerd@leonerd.org.uk>
2021-04-30 | perl v5.32.1 |