Danga-Socket-Callback

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


    Danga::Socket->EventLoop();

# DESCRIPTION

Love the fact that Perlbal, Mogilefs, and friends all run fast because of
Danga::Socket, but despise it because you need to subclass it every time?
Well, here's a module for all you lazy people.

Danga::Socket::Callback is a thin wrapper arond Danga::Socket that allows
you to set callbacks to be called at various events. This allows you to
define multiple Danga::Socket-based sockets without defining multiple
classes:

    my $first = Danga::Socket::Callback->new(
      hadle => $sock1,
      on_read_ready => \&sub1
    );

    my $second = Danga::Socket::Callback->new(
      hadle => $sock2,

README.md  view on Meta::CPAN


## event\_read

## event\_write

## event\_err

## event\_hup

Implements each method available from Danga::Socket. If the corresponding
callbacks are available, then calls the callback. Each callback receives
the Danga::Socket::Callback object.

For event\_write, if no callback is available, then the default event\_write
method from Danga::Socket is called.

# BUGS

Possibly. I don't claim to use 100% of Danga::Socket. If you find any,
please report them (preferrably with a failing test case)

lib/Danga/Socket/Callback.pm  view on Meta::CPAN


  Danga::Socket->EventLoop();

=head1 DESCRIPTION

Love the fact that Perlbal, Mogilefs, and friends all run fast because of
Danga::Socket, but despise it because you need to subclass it every time?
Well, here's a module for all you lazy people.

Danga::Socket::Callback is a thin wrapper arond Danga::Socket that allows
you to set callbacks to be called at various events. This allows you to
define multiple Danga::Socket-based sockets without defining multiple
classes:

  my $first = Danga::Socket::Callback->new(
    hadle => $sock1,
    on_read_ready => \&sub1
  );

  my $second = Danga::Socket::Callback->new(
    hadle => $sock2,

lib/Danga/Socket/Callback.pm  view on Meta::CPAN


=head2 event_read

=head2 event_write

=head2 event_err

=head2 event_hup

Implements each method available from Danga::Socket. If the corresponding
callbacks are available, then calls the callback. Each callback receives
the Danga::Socket::Callback object.

For event_write, if no callback is available, then the default event_write
method from Danga::Socket is called.

=head1 BUGS

Possibly. I don't claim to use 100% of Danga::Socket. If you find any,
please report them (preferrably with a failing test case)



( run in 0.370 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )