summaryrefslogtreecommitdiff
path: root/lib/App/Inotify/Hookable.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/Inotify/Hookable.pm')
-rwxr-xr-xlib/App/Inotify/Hookable.pm28
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/App/Inotify/Hookable.pm b/lib/App/Inotify/Hookable.pm
index cbdf561..e5f189a 100755
--- a/lib/App/Inotify/Hookable.pm
+++ b/lib/App/Inotify/Hookable.pm
@@ -4,7 +4,7 @@ BEGIN {
$App::Inotify::Hookable::AUTHORITY = 'cpan:AVAR';
}
{
- $App::Inotify::Hookable::VERSION = '0.07';
+ $App::Inotify::Hookable::VERSION = '0.09';
}
use Moose;
use MooseX::Types::Moose ':all';
@@ -91,7 +91,7 @@ has buffer_time => (
isa => Int,
default => 100,
cmd_aliases => 't',
- documentation => "How many us should we buffer inotify for? (default 100)",
+ documentation => "How many milliseconds should we buffer inotify for? (default 100)",
);
has ignore_paths => (
@@ -138,7 +138,7 @@ sub log {
my $dumper_squashed = sub {
my $val = shift;
-
+
my $dd = Data::Dumper->new([]);
$dd->Terse(1)->Indent(1)->Useqq(1)->Deparse(1)->Quotekeys(0)->Sortkeys(1)->Indent(0);
return $dd->Values([ $val ])->Dump;
@@ -147,7 +147,7 @@ my $dumper_squashed = sub {
sub run {
my ($self) = @_;
- # Catch sigint so DEMOLISH can run
+ # Catch sigint so DEMOLISH can run
local $SIG{INT} = sub { exit 1 };
my @watch_dirs = $self->watch_directories;
@@ -156,7 +156,8 @@ sub run {
$self->log(
"Starting up, " .
(@watch_dirs ?
- ($self->recursive ? "recursively " : "") .
+ ($self->recursive ? "recursively" : "non-recursively") .
+ " " .
"watching directories <@watch_dirs>" .
(@watch_files ? " and " : "")
: "") .
@@ -218,11 +219,11 @@ sub run {
@events = $notifier->read;
ualarm(0);
} catch {
- $self->log("We have no more events with a timeout of $sleep_ms us") if $self->debug;
+ $self->log("We have no more events with a timeout of $sleep_ms ms") if $self->debug;
};
if (@events) {
- $self->log("We have events, waiting another $sleep_ms us and checking again") if $self->debug;
+ $self->log("We have events, waiting another $sleep_ms ms and checking again") if $self->debug;
$log_modified_paths->(\@events);
} else {
@@ -368,7 +369,7 @@ sub setup_watch {
$path,
(
# Is this is a directory?
- ($type eq 'directory' ?
+ ($type eq 'directory' ?
# Modifications I care about
IN_MODIFY
|
@@ -415,6 +416,13 @@ The original error was:
$error
DIE
+ } elsif ($error == ENOENT) {
+ # Don't hard die on the common race condition where a
+ # file/directory we found with our "find" call has
+ # since gone away (e.g. due to a different "git
+ # checkout" removing it).
+ $self->log("Couldn't watch $type '$path': $error");
+ next WATCH;
} else {
die $error;
}
@@ -513,6 +521,10 @@ something). Patches welcome.
=head1 OPTIONS
+Note that boolean options can be negated with C<--no-OPTION>,
+e.g. C<--no-r> or C<--no-recursive> to turn off the C<--recursive>
+option which is on by default.
+
=head2 C<-w> or C<--watch-directories>
Specify this to watch a directory, you can give this however many