X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FHTTP%2FRestarter%2FWatcher.pm;h=847fb0daadd49fe64af855298d7345a6b7592d30;hp=c01345003ddefbebb874699bb0c2c58e4de059d9;hb=ac5c933bdd463558e8d621507a53a7b247a9093e;hpb=951572c08d33e8364f5cc49286f144015b80b5f9 diff --git a/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm b/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm index c013450..847fb0d 100644 --- a/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm +++ b/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm @@ -1,20 +1,17 @@ package Catalyst::Engine::HTTP::Restarter::Watcher; -use strict; -use warnings; -use base 'Class::Accessor::Fast'; +use Moose; use File::Find; use File::Modified; use File::Spec; use Time::HiRes qw/sleep/; -__PACKAGE__->mk_accessors( - qw/delay - directory - modified - regex - watch_list/ -); +has delay => (is => 'rw'); +has regex => (is => 'rw'); +has modified => (is => 'rw'); +has directory => (is => 'rw'); +has watch_list => (is => 'rw'); +has follow_simlinks => (is => 'rw'); sub new { my ( $class, %args ) = @_; @@ -102,7 +99,9 @@ sub watch { sub _index_directory { my $self = shift; - my $dir = $self->directory || die "No directory specified"; + my $dir = $self->directory; + die "No directory specified" if !$dir or ref($dir) && !@{$dir}; + my $regex = $self->regex || '\.pm$'; my %list; @@ -120,9 +119,10 @@ sub _index_directory { $cur_dir =~ s{/script/..}{}; $list{$cur_dir} = 1; }, + follow_fast => $self->follow_symlinks ? 1 : 0, no_chdir => 1 }, - $dir + ref $dir eq 'ARRAY' ? @{$dir} : $dir ); return \%list; }