| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package AnyEvent::Inotify::EventReceiver; |
|
2
|
|
|
|
|
|
|
$AnyEvent::Inotify::EventReceiver::VERSION = '0.04'; |
|
3
|
3
|
|
|
3
|
|
925
|
use Moose::Role; |
|
|
3
|
|
|
|
|
10301
|
|
|
|
3
|
|
|
|
|
25
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
requires 'handle_access'; |
|
6
|
|
|
|
|
|
|
requires 'handle_modify'; |
|
7
|
|
|
|
|
|
|
requires 'handle_attribute_change'; |
|
8
|
|
|
|
|
|
|
requires 'handle_close'; |
|
9
|
|
|
|
|
|
|
requires 'handle_open'; |
|
10
|
|
|
|
|
|
|
requires 'handle_move'; |
|
11
|
|
|
|
|
|
|
requires 'handle_delete'; |
|
12
|
|
|
|
|
|
|
requires 'handle_create'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub handle_close_write { |
|
15
|
1
|
|
|
1
|
1
|
19
|
my ($self, $f) = @_; |
|
16
|
1
|
|
|
|
|
6
|
$self->handle_close($f); |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub handle_close_nowrite { |
|
20
|
2
|
|
|
2
|
1
|
35
|
my ($self, $f) = @_; |
|
21
|
2
|
|
|
|
|
12
|
$self->handle_close($f); |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# requires 'handle_close_write'; |
|
25
|
|
|
|
|
|
|
# requires 'handle_close_nowrite'; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
AnyEvent::Inotify::EventReceiver - interface of event-receiving classes |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Event receivers must implement these methods. All files and |
|
38
|
|
|
|
|
|
|
directories passed to these methods are actually |
|
39
|
|
|
|
|
|
|
L<Path::Class|Path::Class> objects. The paths provided are always |
|
40
|
|
|
|
|
|
|
relative to the directory that was given to the constructor of the |
|
41
|
|
|
|
|
|
|
C<AnyEvent::Inotify::Simple> object. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Note: "file" below means "file or directory" where that makes sense. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 handle_create |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Called when a new file, C<$file>, appears in the watched directory. |
|
48
|
|
|
|
|
|
|
If it's a directory, we automatically start watching it and calling |
|
49
|
|
|
|
|
|
|
callbacks for files in that directory, still relative to the original |
|
50
|
|
|
|
|
|
|
directory. C<IN_CREATE>. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 handle_access($file) |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Called when C<$file> is accessed. C<IN_ACCESS>. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 handle_modify($file) |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Called when C<$file> is modified. C<IN_MODIFY>. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 handle_attribute_change($file) |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Called when metadata like permissions, timestamps, |
|
63
|
|
|
|
|
|
|
extended attributes, link count (since Linux 2.6.25), UID, GID, |
|
64
|
|
|
|
|
|
|
and so on, changes on C<$file>. C<IN_ATTRIB>. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 handle_open($file) |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Called when something opens C<$file>. C<IN_OPEN>. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 handle_close($file) |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Called when something closes C<$file>. C<IN_CLOSE_WRITE> and |
|
73
|
|
|
|
|
|
|
C<IN_CLOSE_NOWRITE>. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 handle_close_write($file) |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
C<IN_CLOSE_WRITE> only. By default, just calls C<handle_close>, but |
|
78
|
|
|
|
|
|
|
you can override this method and handle it separately. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 handle_close_nowrite($file) |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
C<IN_CLOSE_NOWRITE> only. By default, just calls C<handle_close>, but |
|
83
|
|
|
|
|
|
|
you can override this method and handle it separately. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 handle_move($from, $to) |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Called when C<$from> is moved to C<$to>. (This does not map to a |
|
88
|
|
|
|
|
|
|
single inotify event; we wait for both the C<IN_MOVED_FROM> and |
|
89
|
|
|
|
|
|
|
C<IN_MOVED_TO> events, and call this when we have both.) |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 handle_delete($file) |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Called when C<$file> is deleted. C<IN_DELETE>. (Never called for |
|
94
|
|
|
|
|
|
|
C<IN_DELETE_SELF>, however.) |