1File::ChangeNotify::EveUnste(r3)Contributed Perl DocumenFtialtei:o:nChangeNotify::Event(3)
2
3
4
6 File::ChangeNotify::Event - Class for file change events
7
9 version 0.31
10
12 my $watcher = File::ChangeNotify->instantiate_watcher(
13 directories => [ '/my/path', '/my/other' ],
14 filter => qr/\.(?:pm|conf|yml)$/,
15 exclude => [ 't', 'root', qr(/(?!\.)[^/]+$) ],
16 );
17
18 for my $event ( $watcher->new_events ) {
19 print $event->path, ' - ', $event->type, "\n";
20 }
21
23 This class provides information about a change to a specific file or
24 directory.
25
27 File::ChangeNotify::Event->new(...)
28 This method creates a new event. It accepts the following arguments:
29
30 • path => $path
31
32 The full path to the file or directory that changed.
33
34 • type => $type
35
36 The type of event. This must be one of "create", "modify",
37 "delete", or "unknown".
38
39 $event->path
40 Returns the path of the changed file or directory.
41
42 $event->type
43 Returns the type of event.
44
45 $event->has_attributes
46 This returns true for modify events which include information about a
47 path's attribute changes.
48
49 $event->attributes
50 If the event includes information about changes to a path's attributes,
51 then this returns a two-element arrayref. Each element is in turn a
52 hashref which will contain at least one of the following keys:
53
54 • permissions
55
56 The permissions mask for the path.
57
58 • uid
59
60 The user id that owns the path.
61
62 • gid
63
64 The group id that owns the path.
65
66 Note that only keys which changed will be included.
67
68 $event->has_content
69 This returns true for modify events which include information about a
70 file's content.
71
72 $event->content
73 This returns a two-element arrayref where the first element is the old
74 content and the second is the new content.
75
76 Note that this content is stored as bytes, not UTF-8. You will need to
77 explicitly call "Encode::decode" on the content to make it UTF-8. This
78 is done because there's no reason you couldn't use this feature with
79 file's containing any sort of binary data.
80
82 Bugs may be submitted at
83 <http://rt.cpan.org/Public/Dist/Display.html?Name=File-ChangeNotify> or
84 via email to bug-file-changenotify@rt.cpan.org <mailto:bug-file-
85 changenotify@rt.cpan.org>.
86
87 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
88
90 The source code repository for File-ChangeNotify can be found at
91 <https://github.com/houseabsolute/File-ChangeNotify>.
92
94 Dave Rolsky <autarch@urth.org>
95
97 This software is Copyright (c) 2009 - 2019 by Dave Rolsky.
98
99 This is free software, licensed under:
100
101 The Artistic License 2.0 (GPL Compatible)
102
103 The full text of the license can be found in the LICENSE file included
104 with this distribution.
105
106
107
108perl v5.32.1 2021-01-27 File::ChangeNotify::Event(3)