Why not adopt me?
NAME
POEx::ZMQ3::Role::Emitter - Event emitter for POEx::ZMQ3::Sockets
SYNOPSIS
Primarily used internally; the following public methods are provided to consumers:
$component->add_bind( $alias, $endpoint );
$component->add_connect( $alias, $endpoint );
my @bound = $component->list_binds;
my @connects = $component->list_connects;
$component->close_socket( $alias );
my $backend = $component->zmq;
DESCRIPTION
This is a small wrapper for MooX::Role::POE::Emitter, providing some default attributes and sane defaults for a POEx::ZMQ3::Sockets-based Emitter:
The Emitter's event_prefix is 'zeromq_'
'PROCESS' type events (->process) have the Pluggable prefix 'P_Zmq'
'NOTIFY' type events (->emit) have the Pluggable prefix 'Zmq'
A POEx::ZMQ3::Sockets instance is automatically created if not provided; see "zmq".
Some frontend methods for managing connections on a socket are provided. See below.
Methods
zmq
Takes no arguments.
Returns the current POEx::ZMQ3::Sockets instance.
add_bind
Takes a POEx::ZMQ3::Sockets socket alias and an endpoint to bind.
list_binds
Takes an optional socket alias.
Returns a list of currently-tracked bound endpoints for the socket.
If no alias is specified, returns all currently-tracked aliases with bound endpoints.
add_connect
Takes a socket alias and an endpoint to connect to.
list_connects
Takes the same arguments as "list_binds", but lists connect-type endpoints instead.
close_socket
Takes a socket alias.
Closes and stops tracking the specified socket.
(This happens automatically when 'stop' is called.)
Consumers
A consumer session should override build_defined_states to return an ARRAY suitable for feeding to "object_states" in MooX::Role::POE::Emitter:
sub build_defined_states {
my ($self) = @_;
[
$self => [ qw/
emitter_started
zmqsock_recv
/ ],
]
}
AUTHOR
Jon Portnoy <avenj@cobaltirc.org>