X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FHTTP%2FRestarter%2FWatcher.pm;h=18ce316269a9c4a2ad64437bb3e7bdb70dbca390;hb=7bf342486846ff902822a01c8df4689bfa7a6a6f;hp=b1ae9b74d6449674460c444173c556d11c6673bc;hpb=7fa2c9c1b85c98786655ad5169708d8dc84e8353;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm b/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm index b1ae9b7..18ce316 100644 --- a/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm +++ b/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm @@ -1,6 +1,8 @@ package Catalyst::Engine::HTTP::Restarter::Watcher; use Moose; +with 'MooseX::Emulate::Class::Accessor::Fast'; + use File::Find; use File::Modified; use File::Spec; @@ -11,18 +13,12 @@ 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 ) = @_; - - my $self = {%args}; - - bless $self, $class; +has follow_symlinks => (is => 'rw'); - $self->_init; +no Moose; - return $self; +sub BUILD { + shift->_init; } sub _init { @@ -44,7 +40,7 @@ sub watch { my @changes; my @changed_files; - + my $delay = ( defined $self->delay ) ? $self->delay : 1; sleep $delay if $delay > 0; @@ -153,10 +149,10 @@ files my $watcher = Catalyst::Engine::HTTP::Restarter::Watcher->new( directory => '/path/to/MyApp', - regex => '\.yml$|\.yaml$|\.pm$', + regex => '\.yml$|\.yaml$|\.conf|\.pm$', delay => 1, ); - + while (1) { my @changed_files = $watcher->watch(); } @@ -184,9 +180,7 @@ L, L, L =head1 AUTHORS -Sebastian Riedel, - -Andy Grundman, +Catalyst Contributors, see Catalyst.pm =head1 THANKS