NAME

Tangence::Server - mixin class for building a Tangence server

SYNOPSIS

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] );
}

DESCRIPTION

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.

PROVIDED METHODS

The following methods are provided by this mixin.

$server->registry( $registry )

$registry = $server->registry

Accessor to set or obtain the Tangence::Registry object for the server.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>