| Tangence::Server(3pm) | User Contributed Perl Documentation | Tangence::Server(3pm) |
"Tangence::Server" - mixin class for building a "Tangence" server
This class is a mixin, it cannot be directly constructed
package Example::Server;
use base qw( Base::Server Tangence::Server );
sub new
{
my $class = shift;
my %args = @_;
my $registry = delete $args{registry};
my $self = $class->SUPER::new( %args );
$self->registry( $registry );
return $self;
}
sub tangence_write
{
my $self = shift;
$self->write( $_[0] );
}
sub on_read
{
my $self = shift;
$self->tangence_readfrom( $_[0] );
}
This module provides mixin to implement a "Tangence" server connection. It should be mixed in to an object used to represent a single connection from a client. It provides a location for the objects in server to store information about the client connection, and coordinates passing messages between the client and the objects in the server.
This is a subclass of Tangence::Stream which provides implementations of the required "handle_request_" methods. A class mixing in "Tangence::Server" must still provide the "write" method required for sending data to the client.
For an example of a class that uses this mixin, see Net::Async::Tangence::ServerProtocol.
The following methods are provided by this mixin.
Accessor to set or obtain the Tangence::Registry object for the server.
Paul Evans <leonerd@leonerd.org.uk>
| 2018-07-28 | perl v5.26.2 |