Cosmetic: removed trailing whitespace
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / HTTP / Restarter.pm
index 45b925a..dfb414c 100644 (file)
@@ -20,11 +20,15 @@ around run => sub {
         close STDIN;
         close STDOUT;
 
-        $self->_make_components_mutable($class);
+        # Avoid "Setting config after setup" error restarting MyApp.pm
+        $class->setup_finished(0);
+        # Best effort if we can't trap compiles..
+        $self->_make_components_mutable($class)
+            if !Catalyst::Engine::HTTP::Restarter::Watcher::DETECT_PACKAGE_COMPILATION;
 
         my $watcher = Catalyst::Engine::HTTP::Restarter::Watcher->new(
-            directory => ( 
-                $options->{restart_directory} || 
+            directory => (
+                $options->{restart_directory} ||
                 File::Spec->catdir( $FindBin::Bin, '..' )
             ),
             follow_symlinks => $options->{follow_symlinks},
@@ -79,9 +83,13 @@ around run => sub {
 sub _make_components_mutable {
     my ($self, $class) = @_;
 
-    my @metas = map { find_meta($_) } ($class, map { blessed($_) } values %{ $class->components });
+    my @metas = grep { defined($_) }
+                map { find_meta($_) }
+                ($class, map { blessed($_) }
+                values %{ $class->components });
 
     foreach my $meta (@metas) {
+        # Paranoia unneeded, all component metaclasses should have immutable
         $meta->make_mutable if $meta->is_immutable;
     }
 }
@@ -121,7 +129,7 @@ Many parts are ripped out of C<HTTP::Server::Simple> by Jesse Vincent.
 
 =head1 COPYRIGHT
 
-This program is free software, you can redistribute it and/or modify it under
+This library is free software. You can redistribute it and/or modify it under
 the same terms as Perl itself.
 
 =cut