logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

IO::Event::Callback - A closure based API for IO::Event

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
               },
        );

Name

        IO::Event::Callback - A closure based API for IO::Event

See Also

       See the source for RPC::ToWorker for an exmaple use of IO::Event::Callback.

perl v5.38.2                                       2024-03-05                           IO::Event::Callback(3pm)

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);

See Also