… | |
… | |
152 | =head2 I/O WATCHERS |
152 | =head2 I/O WATCHERS |
153 | |
153 | |
154 | You can create an I/O watcher by calling the C<< AnyEvent->io >> method |
154 | You can create an I/O watcher by calling the C<< AnyEvent->io >> method |
155 | with the following mandatory key-value pairs as arguments: |
155 | with the following mandatory key-value pairs as arguments: |
156 | |
156 | |
157 | C<fh> the Perl I<file handle> (I<not> file descriptor) to watch |
157 | C<fh> the Perl I<file handle> (I<not> file descriptor) to watch for events |
158 | for events. C<poll> must be a string that is either C<r> or C<w>, |
158 | (AnyEvent might or might not keep a reference to this file handle). C<poll> |
159 | which creates a watcher waiting for "r"eadable or "w"ritable events, |
159 | must be a string that is either C<r> or C<w>, which creates a watcher |
160 | respectively. C<cb> is the callback to invoke each time the file handle |
160 | waiting for "r"eadable or "w"ritable events, respectively. C<cb> is the |
161 | becomes ready. |
161 | callback to invoke each time the file handle becomes ready. |
162 | |
162 | |
163 | Although the callback might get passed parameters, their value and |
163 | Although the callback might get passed parameters, their value and |
164 | presence is undefined and you cannot rely on them. Portable AnyEvent |
164 | presence is undefined and you cannot rely on them. Portable AnyEvent |
165 | callbacks cannot use arguments passed to I/O watcher callbacks. |
165 | callbacks cannot use arguments passed to I/O watcher callbacks. |
166 | |
166 | |