class IO::Notification::Change

Changes in a file, produced by watch-file

class IO::Notification::Change {}$path) as well as produce a Supply of IO::Notification::Change events for a file or directory, depending on what is used as the $path argument or IO::Path object.

Here is a small example that prints the first ten FileChanged-notifications for the current working directory:

my $finish =;
my $count = 0;$*CWD).act-> $change {
    $count++ if $change.event ~~ FileChanged;
    say "($count$change.path()$change.event()";
    $finish.keep if $count >= 10;
await $finish;

The type of the change is very much dependent both on the platform and on specific system calls that were used to initiate the change. At this point in time you should not rely on the type of change in general, and test your particular situation.


method path

Returns the path of the file that's being watched.

method event

Returns the type of event: FileChanged or FileRenamed.

method IO

Returns a handle of the file that's being watched.

method gist

Defined as:

multi method gist(IO::Notification::Change:D:)

Returns the path and event attributes, separated by semicolon.

Type Graph

Type relations for IO::Notification::Change
perl6-type-graph IO::Notification::Change IO::Notification::Change Any Any IO::Notification::Change->Any Mu Mu Any->Mu

Expand above chart