--- EV/EV.pm 2007/10/28 06:40:46 1.9 +++ EV/EV.pm 2007/10/29 07:24:37 1.10 @@ -27,7 +27,7 @@ my $w = EV::io \*STDIN, EV::READ | EV::PERSIST, sub { my ($w, $events) = @_; # all callbacks get the watcher object and event mask if ($events & EV::TIMEOUT) { - warn "nothign received on stdin for 10 seconds, retrying"; + warn "nothing received on stdin for 10 seconds, retrying"; } else { warn "stdin is readable, you entered: ", ; } @@ -111,7 +111,7 @@ when the events specified in C<$eventmask> happen. Initially, the timeout is disabled. -Youc an additionall set a timeout to occur on the watcher, but note that +You can additionall set a timeout to occur on the watcher, but note that this timeout will not be reset when you get an I/O event in the EV::PERSIST case, and reaching a timeout will always stop the watcher even in the EV::PERSIST case. @@ -127,6 +127,24 @@ The C variant doesn't add/start the newly created watcher. +=item my $w = EV::timed_io $fileno_or_fh, $eventmask, $timeout, $callback + +=item my $w = EV::timed_io_ns $fileno_or_fh, $eventmask, $timeout, $callback + +Same as C and C, but also specifies a timeout (as if there was +a call to C<< $w->timeout ($timout, 1) >>. The persist flag is not allowed +and will automatically be cleared. The watcher will be restarted after each event. + +If the timeout is zero or undef, no timeout will be set, and a normal +watcher (with the persist flag set!) will be created. + +This has the effect of timing out after the specified period of inactivity +has happened. + +Due to the design of libevent, this is also relatively inefficient, having +one or two io watchers and a separate timeout watcher that you reset on +activity (by calling its C method) is usually more efficient. + =item my $w = EV::timer $after, $repeat, $callback =item my $w = EV::timer_ns $after, $repeat, $callback @@ -204,7 +222,15 @@ =item $old_fh = $w->fh ($new_fh) -Returns the previously set filehandle and optionally set a new one. +Returns the previously set filehandle and optionally set a new one (also +clears the EV::SIGNAL flag when setting a filehandle). + +=item $current_signal = $w->signal + +=item $old_signal = $w->signal ($new_signal) + +Returns the previously set signal number and optionally set a new one (also sets +the EV::SIGNAL flag when setting a signal). =item $current_eventmask = $w->events