Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Watch source files using Supplies
# disclaimer: I'm a perl6 noob :)
my $out =;
$out.act: -> $s { say $s }; # actor model semantics; only ever execute this in 1 thread
my $watcher =$*CWD.abspath)\
.unique(:as(*.path), :expires(1))\ # unique paths over last second, to prevent double-triggering from metadata events
.map(*.path.IO)\ # convert event path strings to IO::Path objects
.grep(*.extension eq 'p6')\
.tap(-> $path { $out.emit: "Source file changed: {$path.basename}" });
Copy link

muraiki commented Sep 4, 2015

You can construct any number of arbitrary watchers, which will operate concurrently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment