Joshua N Pritikin wrote: >Are you sure? The poll attribute defaults to 'w' so not setting it is >not equivolent to it being unset.
OK, then that's a doc bug. There's a lot more missing information about watcher construction too. Here's an attempt to approach completeness: --- Event.pod.old 2004-04-21 09:19:16.000000000 +0100 +++ Event.pod 2004-04-21 10:32:43.000000000 +0100 @@ -244,30 +244,47 @@ The callback is invoked only when no events are pending. If there is never a chance to idle, an event will be generated at least every -C<max> seconds and not more often than C<min> seconds. +C<max> seconds. While Event is idle, events will be generated not more +often than C<min> seconds. + +If neither C<min> nor C<max> is specified, the watcher defaults to +one-shot behaviour (C<repeat> false), otherwise it defaults to repeating. +In either case, the default can be overidden by specifying a C<repeat> +attribute. C<min> defaults to 0.01, and C<max> defaults to infinity. =item var Extra attributes: var => \$var, poll => 'rw' Var watchers generate events when the given variable is read from or -written to. As perl is a concise language, it is often difficult to +written to. C<poll> defaults to "w". + +As perl is a concise language, it is often difficult to predict when a variable will be read. For this reason, variable watchers should poll for writes unless you know what you are doing. =item timer -Extra attributes: at => $time, interval => $sec, hard => $bool +Extra attributes: at => $time, after => $sec, interval => $sec, hard +=> $bool + +The C<$time> and C<$sec> are in seconds. Fractional seconds may be used +if Time::HiRes is available. C<at> and C<after> are mutually exclusive. + +C<at> or C<after> specifies the initial time that the event will occur. +Subsequent timer events occur at intervals specified by C<interval> +or C<after> (in that order of preference) if either was supplied. +The timer defaults to one-shot behaviour if C<interval> was not specified, +or repeating behaviour if C<interval> was specified; in either case this +can be overridden by providing a C<repeat> attribute. -The C<$time> and C<$sec> are in seconds. Fractional seconds may be -used if Time::HiRes is available. The constructor also accepts an -C<after> attribute for easier initialization. It might be useful to +If setting timers for particular times of day, it might be useful to know the time at the start of today. You can find it with: use Time::Local; my $TodaySeconds = int timelocal(0,0,0,(localtime)[3,4,5]); -If C<interval> is set then the watcher will automatically repeat. Be +Be aware that due to lags in the event loop, the C<interval> timeout may already be in the past. If the C<hard> flag is set, the event will be queued for execution relative to the last time the callback was @@ -282,11 +299,12 @@ The callback is invoked when the file descriptor, C<fd>, has data to be read, written, or pending exceptions. C<fd> can be a GLOB, an IO::Handle object, or a file number (file descriptor). +C<poll> defaults to "r". Note that it is your option whether to have multiple watchers per file handle or to use a single watcher for all event conditions. -If timeout_cb is set then timeouts use this alternate callback instead +If C<timeout_cb> is set then timeouts use this alternate callback instead of the main callback. =item signal -zefram
