Skip to content

Instantly share code, notes, and snippets.

@hakobe
Created December 21, 2008 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakobe/38696 to your computer and use it in GitHub Desktop.
Save hakobe/38696 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use File::Modified;
use Perl6::Say;
my ($command, @files) = @ARGV;
my $watcher = File::Modified->new(
method => 'mtime',
files => \@files,
);
while(1) {
my @changes;
eval { @changes = $watcher->changed };
say STDERR "$_ is changed." for @changes;
if (@changes) {
$watcher->update;
system($command);
}
sleep 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment