IO::Event::Callback(3) A closure based API for IO::Event

SYNOPSIS


use IO::Event::Callback;
IO::Event::Callback->new($filehanle, %callbacks);
use IO::Event::INET::Callback;
IO::Event::INET::Callback->new(%socket_info, %callbacks);
use IO::Event::UNIX::Callback;
IO::Event::UNIX::Callback->new(%socket_info, %callbacks);

DESCRIPTION

IO::Event::Callback is a wrapper around IO::Event. It provides an alternative interface to using IO::Event.

Instead of defining a class with methods like ``ie_input'', you provide the callbacks as code references when you create the object.

The keys for the callbacks are the same as the callbacks for IO::Event with the "ie_" prefix removed.

EXAMPLE

 use IO::Event::Callback;
 my $remote = IO::Event::Callback::INET->new(
        peeraddr        => '10.20.10.3',
        peerport        => '23',
        input           => sub { 
                # handle input
        },
        werror          => sub {
                # handdle error
        },
        eof             => sub {
                # handle end-of-file
        },
 );