sort files by mtime descending
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 22 Jun 2010 20:44:17 +0000 (22:44 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 22 Jun 2010 20:44:17 +0000 (22:44 +0200)
lib/MojoFacets/Data.pm

index a650988..a02a563 100644 (file)
@@ -1043,9 +1043,10 @@ sub export {
                }
        }
 
-       $self->render( export => [
-               glob( $self->_export_path . '*' )
-       ] );
+       my @files = glob( $self->_export_path . '*' );
+       my $mtime = { map { $_ => (stat($_))[9] } @files };
+       @files = sort { $mtime->{$b} <=> $mtime->{$a} } @files;
+       $self->render( export => [ @files ] );
 }
 
 sub __loaded_paths {