… | |
… | |
70 | You can create I/O watcher by calling the C<< AnyEvent->io >> method with |
70 | You can create I/O watcher by calling the C<< AnyEvent->io >> method with |
71 | the following mandatory arguments: |
71 | the following mandatory arguments: |
72 | |
72 | |
73 | C<fh> the Perl I<filehandle> (not filedescriptor) to watch for |
73 | C<fh> the Perl I<filehandle> (not filedescriptor) to watch for |
74 | events. C<poll> must be a string that is either C<r> or C<w>, that creates |
74 | events. C<poll> must be a string that is either C<r> or C<w>, that creates |
75 | a watcher waiting for "r"eadable or "w"ritable events. C<cb> teh callback |
75 | a watcher waiting for "r"eadable or "w"ritable events. C<cb> the callback |
76 | to invoke everytime the filehandle becomes ready. |
76 | to invoke everytime the filehandle becomes ready. |
77 | |
77 | |
78 | Only one io watcher per C<fh> and C<poll> combination is allowed (i.e. on |
78 | Only one io watcher per C<fh> and C<poll> combination is allowed (i.e. on |
79 | a socket you can have one r + one w, not any more (limitation comes from |
79 | a socket you can have one r + one w, not any more (limitation comes from |
80 | Tk - if you are sure you are not using Tk this limitation is gone). |
80 | Tk - if you are sure you are not using Tk this limitation is gone). |
… | |
… | |
197 | C<AnyEvent::Impl:xxx> modules, but can be any other class in the case |
197 | C<AnyEvent::Impl:xxx> modules, but can be any other class in the case |
198 | AnyEvent has been extended at runtime (e.g. in I<rxvt-unicode>). |
198 | AnyEvent has been extended at runtime (e.g. in I<rxvt-unicode>). |
199 | |
199 | |
200 | The known classes so far are: |
200 | The known classes so far are: |
201 | |
201 | |
|
|
202 | AnyEvent::Impl::CoroEV based on Coro::EV, best choice. |
202 | EV::AnyEvent based on EV (an interface to libev, best choice) |
203 | AnyEvent::Impl::EV based on EV (an interface to libev, also best choice). |
203 | AnyEvent::Impl::Coro based on Coro::Event, second best choice. |
204 | AnyEvent::Impl::Coro based on Coro::Event, second best choice. |
204 | AnyEvent::Impl::Event based on Event, also second best choice :) |
205 | AnyEvent::Impl::Event based on Event, also second best choice :) |
205 | AnyEvent::Impl::Glib based on Glib, second-best choice. |
206 | AnyEvent::Impl::Glib based on Glib, second-best choice. |
206 | AnyEvent::Impl::Tk based on Tk, very bad choice. |
207 | AnyEvent::Impl::Tk based on Tk, very bad choice. |
207 | AnyEvent::Impl::Perl pure-perl implementation, inefficient. |
208 | AnyEvent::Impl::Perl pure-perl implementation, inefficient. |
… | |
… | |
251 | no warnings; |
252 | no warnings; |
252 | use strict; |
253 | use strict; |
253 | |
254 | |
254 | use Carp; |
255 | use Carp; |
255 | |
256 | |
256 | our $VERSION = '2.55'; |
257 | our $VERSION = '2.6'; |
257 | our $MODEL; |
258 | our $MODEL; |
258 | |
259 | |
259 | our $AUTOLOAD; |
260 | our $AUTOLOAD; |
260 | our @ISA; |
261 | our @ISA; |
261 | |
262 | |
262 | our $verbose = $ENV{PERL_ANYEVENT_VERBOSE}*1; |
263 | our $verbose = $ENV{PERL_ANYEVENT_VERBOSE}*1; |
263 | |
264 | |
264 | our @REGISTRY; |
265 | our @REGISTRY; |
265 | |
266 | |
266 | my @models = ( |
267 | my @models = ( |
|
|
268 | [Coro::EV:: => AnyEvent::Impl::CoroEV::], |
|
|
269 | [EV:: => AnyEvent::Impl::EV::], |
267 | [Coro::Event:: => AnyEvent::Impl::Coro::], |
270 | [Coro::Event:: => AnyEvent::Impl::Coro::], |
268 | [EV:: => EV::AnyEvent::], |
|
|
269 | [Event:: => AnyEvent::Impl::Event::], |
271 | [Event:: => AnyEvent::Impl::Event::], |
270 | [Glib:: => AnyEvent::Impl::Glib::], |
272 | [Glib:: => AnyEvent::Impl::Glib::], |
271 | [Tk:: => AnyEvent::Impl::Tk::], |
273 | [Tk:: => AnyEvent::Impl::Tk::], |
272 | [AnyEvent::Impl::Perl:: => AnyEvent::Impl::Perl::], |
274 | [AnyEvent::Impl::Perl:: => AnyEvent::Impl::Perl::], |
273 | ); |
275 | ); |
… | |
… | |
303 | last; |
305 | last; |
304 | } |
306 | } |
305 | } |
307 | } |
306 | |
308 | |
307 | $MODEL |
309 | $MODEL |
308 | or die "No event module selected for AnyEvent and autodetect failed. Install any one of these modules: Event (or Coro+Event), Glib or Tk."; |
310 | or die "No event module selected for AnyEvent and autodetect failed. Install any one of these modules: EV (or Coro+EV), Event (or Coro+Event), Glib or Tk."; |
309 | } |
311 | } |
310 | |
312 | |
311 | unshift @ISA, $MODEL; |
313 | unshift @ISA, $MODEL; |
312 | push @{"$MODEL\::ISA"}, "AnyEvent::Base"; |
314 | push @{"$MODEL\::ISA"}, "AnyEvent::Base"; |
313 | } |
315 | } |