1 | NAME |
1 | NAME |
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 | |
7 | SYNOPSIS |
8 | SYNOPSIS |
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 | |
… | |
… | |
1358 | mentioned will be used, and preference will be given to protocols |
1360 | mentioned will be used, and preference will be given to protocols |
1359 | mentioned earlier in the list. |
1361 | mentioned earlier in the list. |
1360 | |
1362 | |
1361 | This variable can effectively be used for denial-of-service attacks |
1363 | This variable can effectively be used for denial-of-service attacks |
1362 | against local programs (e.g. when setuid), although the impact is |
1364 | against local programs (e.g. when setuid), although the impact is |
1363 | likely small, as the program has to handle conenction and other |
1365 | likely small, as the program has to handle connection and other |
1364 | failures anyways. |
1366 | failures anyways. |
1365 | |
1367 | |
1366 | Examples: "PERL_ANYEVENT_PROTOCOLS=ipv4,ipv6" - prefer IPv4 over |
1368 | Examples: "PERL_ANYEVENT_PROTOCOLS=ipv4,ipv6" - prefer IPv4 over |
1367 | IPv6, but support both and try to use both. |
1369 | IPv6, but support both and try to use both. |
1368 | "PERL_ANYEVENT_PROTOCOLS=ipv4" - only support IPv4, never try to |
1370 | "PERL_ANYEVENT_PROTOCOLS=ipv4" - only support IPv4, never try to |