Jozef Kutej

NAME

File::Find::Age - mtime sorted files to easily find newest or oldest

SYNOPSIS

    my $oldest = shift(File::Find::Age->in('lib/', 't/'))->{file};
    my $newest = pop(File::Find::Age->in('lib/', 't/'))->{file};

    my $oldest_mtime = shift(File::Find::Age->in('lib/', 't/'))->{mtime};
    my $newest_mtime = pop(File::Find::Age->in('lib/', 't/'))->{mtime};

DESCRIPTION

METHODS

in(@folders)

Returns array ref with list of files found in @folders sorted by mtime.

Sorted list includes one hash ref per file. Ex.:

$VAR1 = [ { 'mtime' => 1239916327, 'file' => 't/00_compile.t' }, { 'mtime' => 1239916327, 'file' => 't/pod-coverage.t' }, { 'mtime' => 1239916327, 'file' => 't/distribution.t' }, { 'mtime' => 1239916327, 'file' => 't/pod.t' }, { 'mtime' => 1284468458, 'file' => 't/pod-spell.t' }, { 'mtime' => 1341080967, 'file' => 'lib/File/Find/Age.pm' } ];

USAGE

I'm using it to find newest mtime of static web files and use this number to invalidate browser cached versions of this files.

    <link href="/static/css/site.css?t=1341080054" rel="stylesheet">
    <script src="/static/js/site.js?t=1341080054"></script>

COPYRIGHT

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

File::Find::Rule

AUTHOR

Jozef Kutej