… | |
… | |
65 | You can create I/O watcher by calling the "AnyEvent->io" method with the |
65 | You can create I/O watcher by calling the "AnyEvent->io" method with the |
66 | following mandatory arguments: |
66 | following mandatory arguments: |
67 | |
67 | |
68 | "fh" the Perl *filehandle* (not filedescriptor) to watch for events. |
68 | "fh" the Perl *filehandle* (not filedescriptor) to watch for events. |
69 | "poll" must be a string that is either "r" or "w", that creates a |
69 | "poll" must be a string that is either "r" or "w", that creates a |
70 | watcher waiting for "r"eadable or "w"ritable events. "cb" teh callback |
70 | watcher waiting for "r"eadable or "w"ritable events. "cb" the callback |
71 | to invoke everytime the filehandle becomes ready. |
71 | to invoke everytime the filehandle becomes ready. |
72 | |
72 | |
73 | Only one io watcher per "fh" and "poll" combination is allowed (i.e. on |
73 | Only one io watcher per "fh" and "poll" combination is allowed (i.e. on |
74 | a socket you can have one r + one w, not any more (limitation comes from |
74 | a socket you can have one r + one w, not any more (limitation comes from |
75 | Tk - if you are sure you are not using Tk this limitation is gone). |
75 | Tk - if you are sure you are not using Tk this limitation is gone). |
… | |
… | |
103 | my $w = AnyEvent->timer (after => 7.7, cb => sub { |
103 | my $w = AnyEvent->timer (after => 7.7, cb => sub { |
104 | warn "timeout\n"; |
104 | warn "timeout\n"; |
105 | }); |
105 | }); |
106 | |
106 | |
107 | # to cancel the timer: |
107 | # to cancel the timer: |
108 | undef $w |
108 | undef $w; |
109 | |
109 | |
110 | CONDITION WATCHERS |
110 | CONDITION WATCHERS |
111 | Condition watchers can be created by calling the "AnyEvent->condvar" |
111 | Condition watchers can be created by calling the "AnyEvent->condvar" |
112 | method without any arguments. |
112 | method without any arguments. |
113 | |
113 | |