From: Andy Grundman Date: Sat, 29 Oct 2005 13:36:05 +0000 (+0000) Subject: Reverted restarter change, until some fixes are made X-Git-Tag: 5.7099_04~1086 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=5d1266aecbc3b839f0b904093ccf282a73e06c91 Reverted restarter change, until some fixes are made --- diff --git a/lib/Catalyst/Engine/HTTP.pm b/lib/Catalyst/Engine/HTTP.pm index de1681b..332e771 100644 --- a/lib/Catalyst/Engine/HTTP.pm +++ b/lib/Catalyst/Engine/HTTP.pm @@ -154,7 +154,7 @@ sub run { # Restart my $files = join ', ', @$changes; - print STDERR qq/"$files" modified, restarting\n\n/; + print STDERR qq/File(s) "$files" modified, restarting\n\n/; kill( 1, $parent ); exit; } @@ -311,60 +311,28 @@ sub _get_line { return $line; } -# The list of files/directories we check for modification -our $file_index; - sub _index { my ( $dir, $regex ) = @_; - - if ( ref $file_index ) { - # don't run a File::Find, but just check file/dir mod times - my %index = %{$file_index}; - foreach my $file ( keys %index ) { - if ( my @stat = stat $file ) { - $index{$file} = $stat[9]; - } - else { - delete $index{$file}; - } - } - return \%index; - } - else { - # first time, run a File::Find to locate files and dirs to watch - my $index = {}; - finddepth( - { - wanted => sub { - my $file = File::Spec->rel2abs($File::Find::name); - $file =~ s{/script/..}{}; - return unless $file =~ /$regex/; - return unless -f $file; - $index->{$file} = ( stat $file )[9]; - - # also watch the directory the file is in - my $cur_dir = File::Spec->rel2abs($File::Find::dir); - $cur_dir =~ s{/script/..}{}; - unless ( $index->{$cur_dir} ) { - $index->{$cur_dir} = ( stat $cur_dir )[9]; - } - }, - no_chdir => 1 + my %index; + finddepth( + { + wanted => sub { + my $file = File::Spec->rel2abs($File::Find::name); + return unless $file =~ /$regex/; + return unless -f $file; + my $time = ( stat $file )[9]; + $index{$file} = $time; }, - $dir - ); - $file_index = $index; - return $file_index; - } + no_chdir => 1 + }, + $dir + ); + return \%index; } sub _test { my $file = shift; delete $INC{$file}; - - # if the file has been deleted, don't try to test it - return 0 unless -f $file; - local $SIG{__WARN__} = sub { }; open my $olderr, '>&STDERR'; open STDERR, '>', File::Spec->devnull;