… | |
… | |
806 | =over 4 |
806 | =over 4 |
807 | |
807 | |
808 | =item Backends that are autoprobed when no other event loop can be found. |
808 | =item Backends that are autoprobed when no other event loop can be found. |
809 | |
809 | |
810 | EV is the preferred backend when no other event loop seems to be in |
810 | EV is the preferred backend when no other event loop seems to be in |
811 | use. If EV is not installed, then AnyEvent will try Event, and, failing |
811 | use. If EV is not installed, then AnyEvent will fall back to its own |
812 | that, will fall back to its own pure-perl implementation, which is |
812 | pure-perl implementation, which is available everywhere as it comes with |
813 | available everywhere as it comes with AnyEvent itself. |
813 | AnyEvent itself. |
814 | |
814 | |
815 | AnyEvent::Impl::EV based on EV (interface to libev, best choice). |
815 | AnyEvent::Impl::EV based on EV (interface to libev, best choice). |
816 | AnyEvent::Impl::Event based on Event, very stable, few glitches. |
|
|
817 | AnyEvent::Impl::Perl pure-perl implementation, fast and portable. |
816 | AnyEvent::Impl::Perl pure-perl implementation, fast and portable. |
818 | |
817 | |
819 | =item Backends that are transparently being picked up when they are used. |
818 | =item Backends that are transparently being picked up when they are used. |
820 | |
819 | |
821 | These will be used when they are currently loaded when the first watcher |
820 | These will be used when they are currently loaded when the first watcher |
822 | is created, in which case it is assumed that the application is using |
821 | is created, in which case it is assumed that the application is using |
823 | them. This means that AnyEvent will automatically pick the right backend |
822 | them. This means that AnyEvent will automatically pick the right backend |
824 | when the main program loads an event module before anything starts to |
823 | when the main program loads an event module before anything starts to |
825 | create watchers. Nothing special needs to be done by the main program. |
824 | create watchers. Nothing special needs to be done by the main program. |
826 | |
825 | |
|
|
826 | AnyEvent::Impl::Event based on Event, very stable, few glitches. |
827 | AnyEvent::Impl::Glib based on Glib, slow but very stable. |
827 | AnyEvent::Impl::Glib based on Glib, slow but very stable. |
828 | AnyEvent::Impl::Tk based on Tk, very broken. |
828 | AnyEvent::Impl::Tk based on Tk, very broken. |
829 | AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse. |
829 | AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse. |
830 | AnyEvent::Impl::POE based on POE, very slow, some limitations. |
830 | AnyEvent::Impl::POE based on POE, very slow, some limitations. |
831 | AnyEvent::Impl::Irssi used when running within irssi. |
831 | AnyEvent::Impl::Irssi used when running within irssi. |
… | |
… | |
1151 | $ENV{PERL_ANYEVENT_PROTOCOLS} || "ipv4,ipv6"; |
1151 | $ENV{PERL_ANYEVENT_PROTOCOLS} || "ipv4,ipv6"; |
1152 | } |
1152 | } |
1153 | |
1153 | |
1154 | my @models = ( |
1154 | my @models = ( |
1155 | [EV:: => AnyEvent::Impl::EV:: , 1], |
1155 | [EV:: => AnyEvent::Impl::EV:: , 1], |
1156 | [Event:: => AnyEvent::Impl::Event::, 1], |
|
|
1157 | [AnyEvent::Impl::Perl:: => AnyEvent::Impl::Perl:: , 1], |
1156 | [AnyEvent::Impl::Perl:: => AnyEvent::Impl::Perl:: , 1], |
1158 | # everything below here will not (normally) be autoprobed |
1157 | # everything below here will not (normally) be autoprobed |
1159 | # as the pureperl backend should work everywhere |
1158 | # as the pureperl backend should work everywhere |
1160 | # and is usually faster |
1159 | # and is usually faster |
|
|
1160 | [Event:: => AnyEvent::Impl::Event::, 1], |
1161 | [Glib:: => AnyEvent::Impl::Glib:: , 1], # becomes extremely slow with many watchers |
1161 | [Glib:: => AnyEvent::Impl::Glib:: , 1], # becomes extremely slow with many watchers |
1162 | [Event::Lib:: => AnyEvent::Impl::EventLib::], # too buggy |
1162 | [Event::Lib:: => AnyEvent::Impl::EventLib::], # too buggy |
1163 | [Irssi:: => AnyEvent::Impl::Irssi::], # Irssi has a bogus "Event" package |
1163 | [Irssi:: => AnyEvent::Impl::Irssi::], # Irssi has a bogus "Event" package |
1164 | [Tk:: => AnyEvent::Impl::Tk::], # crashes with many handles |
1164 | [Tk:: => AnyEvent::Impl::Tk::], # crashes with many handles |
1165 | [Qt:: => AnyEvent::Impl::Qt::], # requires special main program |
1165 | [Qt:: => AnyEvent::Impl::Qt::], # requires special main program |
… | |
… | |
1293 | # "new" API, currently only emulation of it |
1293 | # "new" API, currently only emulation of it |
1294 | ############################################################################# |
1294 | ############################################################################# |
1295 | |
1295 | |
1296 | package AE; |
1296 | package AE; |
1297 | |
1297 | |
|
|
1298 | our $VERSION = $AnyEvent::VERSION; |
|
|
1299 | |
1298 | sub io($$$) { |
1300 | sub io($$$) { |
1299 | AnyEvent->io (fh => $_[0], poll => $_[1] ? "w" : "r", cb => $_[2]) |
1301 | AnyEvent->io (fh => $_[0], poll => $_[1] ? "w" : "r", cb => $_[2]) |
1300 | } |
1302 | } |
1301 | |
1303 | |
1302 | sub timer($$$) { |
1304 | sub timer($$$) { |