X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FRestarter.pm;h=81295f1da53dfdc7b44b2ea06c6f8d1a1833aa06;hb=835133d258cdf1ff5c7f46a3c37230657231e552;hp=c08517a038ac3bd77523562383a898354db10f11;hpb=caa3831b235973486da12d912a9f6176c6c4f0aa;p=catagits%2FCatalyst-Devel.git diff --git a/lib/Catalyst/Restarter.pm b/lib/Catalyst/Restarter.pm index c08517a..81295f1 100644 --- a/lib/Catalyst/Restarter.pm +++ b/lib/Catalyst/Restarter.pm @@ -6,6 +6,7 @@ use Cwd qw( abs_path ); use File::ChangeNotify; use File::Spec; use FindBin; +use Catalyst::Utils; use namespace::clean -except => 'meta'; has start_sub => ( @@ -21,8 +22,9 @@ has argv => ( ); has _watcher => ( - is => 'rw', - isa => 'File::ChangeNotify::Watcher', + is => 'rw', + isa => 'File::ChangeNotify::Watcher', + clearer => '_clear_watcher', ); has _filter => ( @@ -48,8 +50,7 @@ sub pick_subclass { $subclass = 'Catalyst::Restarter::' . $subclass; - eval "use $subclass"; - die $@ if $@; + Catalyst::Utils::ensure_class_loaded($subclass); return $subclass; } @@ -116,9 +117,11 @@ sub _handle_events { for my $event (@events) { my $path = $event->path(); my $type = $event->type(); - if ( ( $type ne 'delete' && -f $path ) - || ( $type eq 'delete' && $path =~ $self->_filter ) ) - { + if ( ( ( $type ne 'delete' && -f $path ) + || ( $type eq 'delete' ) + ) + && ( $path =~ $self->_filter ) + ) { push @files, { path => $path, type => $type }; } }