X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FHTTP.pm;h=332e771aaacbd4733612af99cd952b6090d70dd9;hb=5d1266aecbc3b839f0b904093ccf282a73e06c91;hp=14b441acecc150cd70db0c5cea9276d7be188330;hpb=ee110ef53642ef3f47e00a3ac0c3c01c8ccecdec;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/HTTP.pm b/lib/Catalyst/Engine/HTTP.pm index 14b441a..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,62 +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; - my $time = ( stat $file )[9]; - $index->{$file} = $time; - - # 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} ) { - my $time = ( stat $cur_dir )[9]; - $index->{$cur_dir} = $time; - } - }, - 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;