The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Argon::Server - Base class for Argon server objects

VERSION

version 0.17

SYNOPSIS

  use Moose;
  use Argon::Constants ':commands';
  use Argon::Server;

  extends 'Argon::Server';

  after configure => sub{
    my $self = shift;
    $self->handles($SOME_COMMAND, K('_handler_method_name', $self));
  };

DESCRIPTION

Provides TCP listener services for Ar classes.

ATTRIBUTES

keyfile

Path to the file containing the encryption pass phrase. Inherited from Argon::Encryption.

host

The hostname or interface on which to listen. Defaults to 127.0.0.1.

port

The port on which the server should listen. If not specified, an OS-assigned port is used and the attribute is set once the listening socket has been configured.

METHODS

start

Starts the manager.

listen

Creates the listener socket. Called by "start".

configure

Classes inheriting Argon::Server register protocol verb handlers with the "handles" in Argon::Server method. The configure method provides a trigger for registering actions during start up.

  after configure => sub{
    my $self = shift;
    $self->handles($ACTION, K('_handler', $self));
  };

handles

Registers a handler for a protocol command verb.

  $self->handles($ACTION, K('_handler_method'), $self));

See ":commands" in Argon::Constants.

send

Sends a reply Argon::Message. Emits a warning and returns early if the message's id does not match one sent by an existing client.

AUTHOR

Jeff Ober <sysread@fastmail.fm>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Jeff Ober.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.