From: Matt S Trout Date: Tue, 26 Aug 2014 13:49:21 +0000 (+0000) Subject: clean up stat code X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2f5c23b346a1ad8317409082abd9a2a4a43337fc;p=scpubgit%2FApp-SCS.git clean up stat code --- diff --git a/lib/App/SCS/PageSet.pm b/lib/App/SCS/PageSet.pm index ce4c507..208772c 100644 --- a/lib/App/SCS/PageSet.pm +++ b/lib/App/SCS/PageSet.pm @@ -93,15 +93,10 @@ sub _inflate { (my $cache_name = $io->name) =~ s/\/([^\/]+)$/\/.htcache.$1.json/; my $cache = io($cache_name); my $config_files = $self->_config_files_for($path); - my $maxstat = 0; - - if (scalar @$config_files) { - my $maxfile = reduce { $a->mtime > $b->mtime ? $a : $b } @$config_files; - $maxstat = $maxfile->mtime; - } + my $max_stat = max map $_->mtime, $io, @$config_files; if (-f $cache_name) { - if ($cache->mtime >= max($io->mtime, $maxstat)) { + if ($cache->mtime >= $max_stat) { return try { $self->_new_page($path, $self->_json->decode($cache->all)); } catch {