From: epg <> Date: Fri, 12 Mar 2004 03:44:18 +0000 (+0000) Subject: (preprocess): Return the @result list sorted by mtime. X-Git-Url: https://diplodocus.org/git/minc/commitdiff_plain/597007a45ea4618eea4b55fb9d58fc60502f320f (preprocess): Return the @result list sorted by mtime. --- diff --git a/minc b/minc index 9f006ef..87a7813 100755 --- a/minc +++ b/minc @@ -33,6 +33,7 @@ use Errno; use Fcntl qw(O_WRONLY O_EXCL O_CREAT); use FileHandle; use File::Basename; +use File::stat; use Getopt::Std; use Log::Dispatch; use Log::Dispatch::File; @@ -575,6 +576,7 @@ sub preprocess { my @baton; my $msg; my $i; + my $st; my @result; @baton = spam_start_hook(); @@ -596,7 +598,15 @@ sub preprocess { spam_stop_hook(@baton); - return @result; + return (map { $_->[1] } + sort { $a->[0] <=> $b->[0] } + map { + if (not ($st = stat($_))) { + die("stat($_): $!"); + } + [$st->mtime, $_] + } + @result); }