NAME

POEx::ZMQ::FFI::Context - Backend ZeroMQ context objects for POEx::ZMQ

SYNOPSIS

# Used internally by POEx::ZMQ; see below for useful methods

DESCRIPTION

An object representing a ZeroMQ context.

These are typically created via a higher-level mechanism (see POEx::ZMQ) and accessible from your POEx::ZMQ::Socket instance:

my $ctx = $my_sock->context;
my $keypair = $ctx->generate_keypair;
# ...

ATTRIBUTES

soname

The dynamic library name to use (see FFI::Raw).

Defaults to calling "find_soname" in POEx::ZMQ::FFI.

threads

The size of the ZeroMQ IO thread pool.

Defaults to 1.

max_sockets

The maximum number of sockets allowed on this context.

Defaults to 1023 (the ZMQ4 default).

METHODS

create_socket

my $sock = $ctx->create_socket($type);

Returns a new POEx::ZMQ::FFI::Socket for the given type.

There is no destroy method; the ZeroMQ context is terminated when the object, and any sock created on this context, falls out of scope.

get_ctx_opt

my $val = $ctx->get_ctx_opt( $option );

Retrieve context options.

See zmq_ctx_get(3).

set_ctx_opt

$ctx->set_ctx_opt( $option, $value );

Set context options.

See zmq_ctx_set(3).

get_raw_context

Returns the raw context pointer, suitable for use with direct FFI::Raw calls (used internally by POEx::ZMQ::FFI::Socket objects).

get_zmq_version

my $vstruct = $ctx->get_zmq_version;
my $major   = $vstruct->major;
# See POEx::ZMQ::FFI for complete method list

Returns the "get_version" in POEx::ZMQ::FFI struct-like object for the current "soname".

CONSUMES

POEx::ZMQ::FFI::Role::ErrorChecking

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>

Significant portions of this code are inspired by or derived from ZMQ::FFI by Dylan Calid (CPAN: CALID).