The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

  # Used internally by POEx::ZMQ

DESCRIPTION

A Moo::Role consumed by classes comprising the POEx::ZMQ FFI backend.

Errors produced/thrown by these methods are instances of POEx::ZMQ::FFI::Error.

ATTRIBUTES

err_handler

The error handler is a POEx::ZMQ::FFI::Callable instance providing direct access to the zmq_errno(3) and zmq_strerror(3) functions.

METHODS

errno

Calls zmq_errno(3) to get the errno value for the previous (failed) call.

Used to build a thrown POEx::ZMQ::FFI::Error.

errstr

Calls zmq_strerror(3) to get the error string for the current "errno".

An errno can be supplied if one was previously retrieved:

  my $errstr = $self->errstr( $errno );

Used to build a thrown POEx::ZMQ::FFI::Error.

throw_zmq_error

  $self->throw_zmq_error( $zmq_function );

Throws a POEx::ZMQ::FFI::Error, unconditionally.

The ZMQ function name is purely informational; "errno" and "errstr" are automatically retrieved for inclusion in the thrown exception object.

throw_if_error

  $self->throw_if_error( $zmq_function =>
    $call_zmq_ffi_func->(@args)
  );

Takes a ZMQ function name and a return code from a ZMQ FFI call; calls "throw_zmq_error" if the return code indicates the call failed.

warn_if_error

Like "throw_if_error", but warn via "cluck" in Carp rather than throwing an error object.

Returns the invocant if there was no error, else returns false.

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>