Catalyst::Utils is not an exporter
[catagits/Catalyst-Devel.git] / lib / Catalyst / Restarter.pm
index 104ce5a..fd5a534 100644 (file)
@@ -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 => (
@@ -48,8 +49,7 @@ sub pick_subclass {
 
     $subclass = 'Catalyst::Restarter::' . $subclass;
 
-    eval "use $subclass";
-    die $@ if $@;
+    Catalyst::Utils::ensure_class_loaded($subclass);
 
     return $subclass;
 }
@@ -74,7 +74,7 @@ sub BUILD {
         qr(/\.[^/]*/?$),    # match hidden dirs
     ];
 
-    # keep filter regexp to make shure we don't restart on deleted
+    # keep filter regexp to make sure we don't restart on deleted
     # files or directories where we can't check -d
     $self->_filter( $p->{filter} );
 
@@ -111,6 +111,8 @@ sub _handle_events {
     my @events = @_;
 
     my @files;
+    # Filter out any events which are the creation / deletion of directories
+    # so that creating an empty directory won't cause a restart
     for my $event (@events) {
         my $path = $event->path();
         my $type = $event->type();
@@ -200,7 +202,7 @@ the child, forks again, and starts a new server.
 
 =head1 SEE ALSO
 
-L<Catalyst>, <File::ChangeNotify>
+L<Catalyst>, L<File::ChangeNotify>
 
 =head1 AUTHORS