plucky (3) Tangence::Server.3pm.gz

Provided by: libtangence-perl_0.33-1_all bug

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.

   registry
          $server->registry( $registry )

          $registry = $server->registry

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

OVERRIDEABLE METHODS

       The following methods are provided but intended to be overridden if the implementing class wishes to
       provide different behaviour from the default.

   rootobj
          $rootobj = $server->rootobj( $identity )

       Invoked when a "GETROOT" message is received from the client, this method should return a
       Tangence::Object as root object for the connection.

       The default implementation will return the object with ID 1; i.e. the first object created in the
       registry.

   permit_registry
          $allow = $server->permit_registry

       Invoked when a "GETREGISTRY" message is received from the client, this method should return a boolean to
       indicate whether the client is allowed to access the object registry.

       The default implementation always permits this, but an overridden method may decide to disallow it in
       some situations. When disabled, a client will not be able to gain access to any serverside objects other
       than the root object, and (recursively) any other objects returned by methods, events or properties on
       objects already known. This can be used as a security mechanism.

AUTHOR

       Paul Evans <leonerd@leonerd.org.uk>