Linux::Event::Connect

CI

Nonblocking outbound socket connect primitive for the Linux::Event ecosystem.

Install

cpanm Linux::Event::Connect

Quick start

use v5.36;
use Linux::Event;
use Linux::Event::Connect;

my $loop = Linux::Event->new;

Linux::Event::Connect->new(
  loop => $loop,
  host => '127.0.0.1',
  port => 1234,
  timeout_s => 5,

  on_connect => sub ($req, $fh, $data) {
    # connected nonblocking socket
    close $fh;
    $loop->stop;
  },

  on_error => sub ($req, $errno, $data) {
    local $! = $errno;
    warn "connect failed: $errno ($!)\n";
    $loop->stop;
  },
);

$loop->run;

Address modes

Exactly one of these is required:

Examples

See examples/.

Performance notes

License

Same terms as Perl itself.