ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/README
(Generate patch)

Comparing AnyEvent/README (file contents):
Revision 1.72 by root, Tue Dec 17 16:43:15 2013 UTC vs.
Revision 1.75 by root, Thu Jul 16 12:48:38 2015 UTC

1NAME 1NAME
2 AnyEvent - the DBI of event loop programming 2 AnyEvent - the DBI of event loop programming
3 3
4 EV, Event, Glib, Tk, Perl, Event::Lib, Irssi, rxvt-unicode, IO::Async, 4 EV, Event, Glib, Tk, UV, Perl, Event::Lib, Irssi, rxvt-unicode,
5 Qt, FLTK and POE are various supported event loops/environments. 5 IO::Async, Qt, FLTK and POE are various supported event
6 loops/environments.
6 7
7SYNOPSIS 8SYNOPSIS
8 use AnyEvent; 9 use AnyEvent;
9 10
10 # if you prefer function calls, look at the AE manpage for 11 # if you prefer function calls, look at the AE manpage for
843 by the main program. 844 by the main program.
844 845
845 AnyEvent::Impl::Event based on Event, very stable, few glitches. 846 AnyEvent::Impl::Event based on Event, very stable, few glitches.
846 AnyEvent::Impl::Glib based on Glib, slow but very stable. 847 AnyEvent::Impl::Glib based on Glib, slow but very stable.
847 AnyEvent::Impl::Tk based on Tk, very broken. 848 AnyEvent::Impl::Tk based on Tk, very broken.
849 AnyEvent::Impl::UV based on UV, innovated square wheels.
848 AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse. 850 AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse.
849 AnyEvent::Impl::POE based on POE, very slow, some limitations. 851 AnyEvent::Impl::POE based on POE, very slow, some limitations.
850 AnyEvent::Impl::Irssi used when running within irssi. 852 AnyEvent::Impl::Irssi used when running within irssi.
851 AnyEvent::Impl::IOAsync based on IO::Async. 853 AnyEvent::Impl::IOAsync based on IO::Async.
852 AnyEvent::Impl::Cocoa based on Cocoa::EventLoop. 854 AnyEvent::Impl::Cocoa based on Cocoa::EventLoop.
984 To understand the usefulness of this function, consider a function 986 To understand the usefulness of this function, consider a function
985 that asynchronously does something for you and returns some 987 that asynchronously does something for you and returns some
986 transaction object or guard to let you cancel the operation. For 988 transaction object or guard to let you cancel the operation. For
987 example, "AnyEvent::Socket::tcp_connect": 989 example, "AnyEvent::Socket::tcp_connect":
988 990
989 # start a conenction attempt unless one is active 991 # start a connection attempt unless one is active
990 $self->{connect_guard} ||= AnyEvent::Socket::tcp_connect "www.example.net", 80, sub { 992 $self->{connect_guard} ||= AnyEvent::Socket::tcp_connect "www.example.net", 80, sub {
991 delete $self->{connect_guard}; 993 delete $self->{connect_guard};
992 ... 994 ...
993 }; 995 };
994 996
1028 If you want to sprinkle loads of logging calls around your code, 1030 If you want to sprinkle loads of logging calls around your code,
1029 consider creating a logger callback with the "AnyEvent::Log::logger" 1031 consider creating a logger callback with the "AnyEvent::Log::logger"
1030 function, which can reduce typing, codesize and can reduce the 1032 function, which can reduce typing, codesize and can reduce the
1031 logging overhead enourmously. 1033 logging overhead enourmously.
1032 1034
1035 AnyEvent::fh_block $filehandle
1036 AnyEvent::fh_unblock $filehandle
1037 Sets blocking or non-blocking behaviour for the given filehandle.
1038
1033WHAT TO DO IN A MODULE 1039WHAT TO DO IN A MODULE
1034 As a module author, you should "use AnyEvent" and call AnyEvent methods 1040 As a module author, you should "use AnyEvent" and call AnyEvent methods
1035 freely, but you should not load a specific event module or rely on it. 1041 freely, but you should not load a specific event module or rely on it.
1036 1042
1037 Be careful when you create watchers in the module body - AnyEvent will 1043 Be careful when you create watchers in the module body - AnyEvent will
1358 mentioned will be used, and preference will be given to protocols 1364 mentioned will be used, and preference will be given to protocols
1359 mentioned earlier in the list. 1365 mentioned earlier in the list.
1360 1366
1361 This variable can effectively be used for denial-of-service attacks 1367 This variable can effectively be used for denial-of-service attacks
1362 against local programs (e.g. when setuid), although the impact is 1368 against local programs (e.g. when setuid), although the impact is
1363 likely small, as the program has to handle conenction and other 1369 likely small, as the program has to handle connection and other
1364 failures anyways. 1370 failures anyways.
1365 1371
1366 Examples: "PERL_ANYEVENT_PROTOCOLS=ipv4,ipv6" - prefer IPv4 over 1372 Examples: "PERL_ANYEVENT_PROTOCOLS=ipv4,ipv6" - prefer IPv4 over
1367 IPv6, but support both and try to use both. 1373 IPv6, but support both and try to use both.
1368 "PERL_ANYEVENT_PROTOCOLS=ipv4" - only support IPv4, never try to 1374 "PERL_ANYEVENT_PROTOCOLS=ipv4" - only support IPv4, never try to
2119 2125
2120 Development/Debugging: AnyEvent::Strict (stricter checking), 2126 Development/Debugging: AnyEvent::Strict (stricter checking),
2121 AnyEvent::Debug (interactive shell, watcher tracing). 2127 AnyEvent::Debug (interactive shell, watcher tracing).
2122 2128
2123 Supported event modules: AnyEvent::Loop, EV, EV::Glib, Glib::EV, Event, 2129 Supported event modules: AnyEvent::Loop, EV, EV::Glib, Glib::EV, Event,
2124 Glib::Event, Glib, Tk, Event::Lib, Qt, POE, FLTK. 2130 Glib::Event, Glib, Tk, Event::Lib, Qt, POE, FLTK, Cocoa::EventLoop, UV.
2125 2131
2126 Implementations: AnyEvent::Impl::EV, AnyEvent::Impl::Event, 2132 Implementations: AnyEvent::Impl::EV, AnyEvent::Impl::Event,
2127 AnyEvent::Impl::Glib, AnyEvent::Impl::Tk, AnyEvent::Impl::Perl, 2133 AnyEvent::Impl::Glib, AnyEvent::Impl::Tk, AnyEvent::Impl::Perl,
2128 AnyEvent::Impl::EventLib, AnyEvent::Impl::Qt, AnyEvent::Impl::POE, 2134 AnyEvent::Impl::EventLib, AnyEvent::Impl::Qt, AnyEvent::Impl::POE,
2129 AnyEvent::Impl::IOAsync, Anyevent::Impl::Irssi, AnyEvent::Impl::FLTK. 2135 AnyEvent::Impl::IOAsync, AnyEvent::Impl::Irssi, AnyEvent::Impl::FLTK,
2136 AnyEvent::Impl::Cocoa, AnyEvent::Impl::UV.
2130 2137
2131 Non-blocking handles, pipes, stream sockets, TCP clients and servers: 2138 Non-blocking handles, pipes, stream sockets, TCP clients and servers:
2132 AnyEvent::Handle, AnyEvent::Socket, AnyEvent::TLS. 2139 AnyEvent::Handle, AnyEvent::Socket, AnyEvent::TLS.
2133 2140
2134 Asynchronous File I/O: AnyEvent::IO. 2141 Asynchronous File I/O: AnyEvent::IO.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines