use File::ChangeNotify;
use File::Spec;
use FindBin;
+use Catalyst::Utils;
use namespace::clean -except => 'meta';
has start_sub => (
);
has _watcher => (
- is => 'rw',
- isa => 'File::ChangeNotify::Watcher',
+ is => 'rw',
+ isa => 'File::ChangeNotify::Watcher',
+ clearer => '_clear_watcher',
);
has _filter => (
$subclass = 'Catalyst::Restarter::' . $subclass;
- eval "use $subclass";
- die $@ if $@;
+ Catalyst::Utils::ensure_class_loaded($subclass);
return $subclass;
}
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 };
}
}