```{index} single: EV::IO ``` # EV::IO ```{pperl-module-badges} EV::IO ``` An I/O watcher, as `EV::io` makes: its callback runs when a file handle is readable or writable. These methods change what it watches; the methods all watchers share are `EV::Watcher`'s. Changing an active watcher stops and restarts it, losing its pending events. ## Synopsis ```perl my $w = EV::io $sock, EV::READ, \&on_read; $w->events(EV::READ | EV::WRITE); # also wait until writable $w->set($other_sock, EV::READ); # watch another handle ``` ## Functions ### Configuration #### `set` Watch another handle, for other events: `$w->set($fh, EV::READ)`. The handle may be a file handle or a descriptor number; one without a descriptor croaks `illegal file descriptor or filehandle`. #### `fh` The handle the watcher watches, as it was given; with an argument, watch that handle instead and return the old one. #### `events` The events the watcher waits for, `EV::READ`, `EV::WRITE` or both; with an argument, wait for those instead and return the old mask.