|
NAMEDanga::Socket::Callback - Use Danga::Socket From CallbacksSYNOPSISmy $danga = Danga::Socket::Callback->new( handle => $socket, context => { ... }, on_read_ready => sub { ... }, on_write_ready => sub { ... }, on_error => sub { ... }, on_signal_hup => sub { ... }, ); Danga::Socket->EventLoop(); DESCRIPTIONLove 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, on_read_ready => \&sub2 ); Danga::Socket->EventLoop(); METHODSnewCreates a new instance of Danga::Socket::Callback. Takes the following parameters:
event_readevent_writeevent_errevent_hupImplements 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. BUGSPossibly. I don't claim to use 100% of Danga::Socket. If you find any, please report them (preferrably with a failing test case)AUTHORCopyright (c) Daisuke Maki <daisuke@endeworks.jp> All rights reserved.LICENSEThis program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.See http://www.perl.com/perl/misc/Artistic.html
Visit the GSP FreeBSD Man Page Interface. |