--- EV/EV.pm 2007/11/27 08:11:52 1.55 +++ EV/EV.pm 2007/11/27 10:59:10 1.56 @@ -78,12 +78,14 @@ @EV::Timer::ISA = @EV::Periodic::ISA = @EV::Signal::ISA = +@EV::Child::ISA = +@EV::Stat::ISA = @EV::Idle::ISA = @EV::Prepare::ISA = @EV::Check::ISA = -@EV::Child::ISA = @EV::Embed::ISA = -@EV::Stat::ISA = "EV::Watcher"; +@EV::Fork::ISA = + "EV::Watcher"; =head1 BASIC INTERFACE @@ -553,6 +555,50 @@ =back +=head3 STAT WATCHERS - did the file attributes just change? + +=over 4 + +=item $w = EV::stat $path, $interval, $callback + +=item $w = EV::stat_ns $path, $interval, $callback + +Call the callback when a file status change has been detected on +C<$path>. The C<$path> does not need to exist, changing from "path exists" +to "path does not exist" is a status change like any other. + +The C<$interval> is a recommended polling interval for systems where +OS-supported change notifications don't exist or are not supported. If +you use C<0> then an unspecified default is used (which is highly +recommended!), which is to be expected to be around five seconds usually. + +This watcher type is not meant for massive numbers of stat watchers, +as even with OS-supported change notifications, this can be +resource-intensive. + +The C variant doesn't start (activate) the newly created watcher. + +=item $w->set ($path, $interval) + +Reconfigures the watcher, see the constructor above for details. Can be +called at any time. + +=item $current_path = $w->path + +=item $old_path = $w->path ($new_path) + +Returns the previously set path and optionally set a new one. + +=item $current_interval = $w->interval + +=item $old_interval = $w->interval ($new_interval) + +Returns the previously set interval and optionally set a new one. Can be +used to query the actual interval used. + +=back + + =head3 IDLE WATCHERS - when you've got nothing better to do... =over 4 @@ -648,46 +694,23 @@ =back -=head3 STAT WATCHERS - did the file attributes just change? - -=over 4 - -=item $w = EV::stat $path, $interval, $callback - -=item $w = EV::stat_ns $path, $interval, $callback - -Call the callback when a file status change has been detected on -C<$path>. The C<$path> does not need to exist, changing from "path exists" -to "path does not exist" is a status change like any other. - -The C<$interval> is a recommended polling interval for systems where -OS-supported change notifications don't exist or are not supported. If -you use C<0> then an unspecified default is used (which is highly -recommended!), which is to be expected to be around five seconds usually. - -This watcher type is not meant for massive numbers of stat watchers, -as even with OS-supported change notifications, this can be -resource-intensive. - -The C variant doesn't start (activate) the newly created watcher. - -=item $w->set ($path, $interval) -Reconfigures the watcher, see the constructor above for details. Can be -called at any time. +=head3 FORK WATCHERS - the audacity to resume the event loop after a fork -=item $current_path = $w->path +Fork watchers are called when a C was detected. The invocation +is done before the event loop blocks next and before C watchers +are being called, and only in the child after the fork. -=item $old_path = $w->path ($new_path) +=over 4 -Returns the previously set path and optionally set a new one. +=item $w = EV::fork $callback -=item $current_interval = $w->interval +=item $w = EV::fork_ns $callback -=item $old_interval = $w->interval ($new_interval) +Call the callback before the event loop is resumed in the child process +after a fork. -Returns the previously set interval and optionally set a new one. Can be -used to query the actual interval used. +The C variant doesn't start (activate) the newly created watcher. =back