NAME
Linux::Event::Operation - In-flight operation object for Linux::Event::Proactor
SYNOPSIS
my $op = $loop->read(
fh => $fh,
len => 4096,
data => $ctx,
on_complete => sub ($op, $result, $ctx) {
return if $op->is_cancelled;
if ($op->failed) {
warn $op->error->message;
return;
}
my $state = $op->state;
my $kind = $op->kind;
my $res = $op->result;
},
);
$op->cancel;
DESCRIPTION
Linux::Event::Operation represents one in-flight action submitted through Linux::Event::Proactor. Users obtain operation objects from the proactor loop; they are not normally constructed directly.
An operation carries its kind, state, result or error, optional user data, and a deferred completion callback.
STATES
An operation begins in pending and then settles exactly once into one of these terminal states:
doneThe operation completed. Inspect
successorfailedto distinguish success from failure.cancelledCancellation won the race.
METHODS
loop
Return the owning proactor.
kind
Return the operation kind, such as read, send, or timeout.
data
Return the user data payload associated with the operation.
state
Return the state string.
result
Return the normalized success result, if any.
error
Return the Linux::Event::Error object for failed operations.
is_pending
is_done
is_cancelled
Predicate helpers for state inspection.
success
True when the operation completed successfully.
failed
True when the operation completed with an error.
cancel
Request cancellation through the owning proactor.
CALLBACKS
The user callback, if one was supplied, is queued by the proactor and later run with this ABI:
$cb->($op, $result, $data)
Callbacks are never executed inline by the backend.