… | |
… | |
55 | use Scalar::Util (); |
55 | use Scalar::Util (); |
56 | |
56 | |
57 | use base 'Exporter'; |
57 | use base 'Exporter'; |
58 | |
58 | |
59 | BEGIN { |
59 | BEGIN { |
60 | $VERSION = 0.2; |
60 | $VERSION = 0.8; |
61 | |
61 | |
62 | @constants = qw( |
62 | @constants = qw( |
63 | IN_ACCESS IN_MODIFY IN_ATTRIB IN_CLOSE_WRITE |
63 | IN_ACCESS IN_MODIFY IN_ATTRIB IN_CLOSE_WRITE |
64 | IN_CLOSE_NOWRITE IN_OPEN IN_MOVED_FROM IN_MOVED_TO |
64 | IN_CLOSE_NOWRITE IN_OPEN IN_MOVED_FROM IN_MOVED_TO |
65 | IN_CREATE IN_DELETE IN_DELETE_SELF IN_MOVE_SELF |
65 | IN_CREATE IN_DELETE IN_DELETE_SELF IN_MOVE_SELF |
… | |
… | |
215 | |
215 | |
216 | exists $self->{ignore}{$_->{wd}} |
216 | exists $self->{ignore}{$_->{wd}} |
217 | and next; # watcher has been canceled |
217 | and next; # watcher has been canceled |
218 | |
218 | |
219 | $w->{cb}->(bless $_, Linux::Inotify2::Event); |
219 | $w->{cb}->(bless $_, Linux::Inotify2::Event); |
220 | # TODO: what about IN_ONESHOT? |
|
|
221 | $w->cancel if $_->{mask} & (IN_IGNORED | IN_UNMOUNT); |
220 | $w->cancel if $_->{mask} & (IN_IGNORED | IN_UNMOUNT | IN_ONESHOT); |
222 | } |
221 | } |
223 | |
222 | |
224 | delete $self->{ignore}; |
223 | delete $self->{ignore}; |
225 | |
224 | |
226 | scalar @ev |
225 | scalar @ev |
… | |
… | |
264 | |
263 | |
265 | The received event mask. In addition the the events described for |
264 | The received event mask. In addition the the events described for |
266 | C<$inotify->watch>, the following flags (exported by default) can be set: |
265 | C<$inotify->watch>, the following flags (exported by default) can be set: |
267 | |
266 | |
268 | IN_ISDIR event object is a directory |
267 | IN_ISDIR event object is a directory |
269 | |
|
|
270 | IN_Q_OVERFLOW event queue overflowed |
268 | IN_Q_OVERFLOW event queue overflowed |
271 | |
269 | |
272 | # when the following flags are set, then watchers are canceled automatically |
270 | # when any of the following flags are set, |
|
|
271 | # then watchers for this event are automatically canceled |
273 | IN_UNMOUNT filesystem for watch'ed object was unmounted |
272 | IN_UNMOUNT filesystem for watch'ed object was unmounted |
274 | IN_IGNORED file was ignored/is gone (no more events are delivered) |
273 | IN_IGNORED file was ignored/is gone (no more events are delivered) |
|
|
274 | IN_ONESHOT only one event was generated |
275 | |
275 | |
276 | =item $event->IN_xxx |
276 | =item $event->IN_xxx |
277 | |
277 | |
278 | Returns a boolean that returns true if the event mask matches the |
278 | Returns a boolean that returns true if the event mask matches the |
279 | event. All of the C<IN_xxx> constants can be used as methods. |
279 | event. All of the C<IN_xxx> constants can be used as methods. |
280 | |
280 | |
281 | =item $event->cookie |
281 | =item $event->cookie |
282 | |
282 | |
283 | =item $event->{cookie} |
283 | =item $event->{cookie} |
284 | |
284 | |
285 | The event cookie to "synchronize two events". Currently, this is always |
285 | The event cookie to "synchronize two events". Normally zero, this value is |
286 | zero, and I have no idea what it's supposed use is. Educate me! |
286 | set when two events relating to the same file are generated. As far as I |
|
|
287 | know, this only happens for C<IN_MOVED_FROM> and C<IN_MOVED_TO> events, to |
|
|
288 | identify the old and new name of a file. |
287 | |
289 | |
288 | =back |
290 | =back |
289 | |
291 | |
290 | =cut |
292 | =cut |
291 | |
293 | |