NAME File::is - file is older? oldest? is newer? newest? similar? the same? VERSION Version 0.01 SYNOPSIS use File::is; # return if F is newer than F or F. return if File::is->newer('file1', 'file2', 'file3'); # do something if F is older than F or F. do_some_work() if File::is->older([ 'path1', 'file1'], 'file2', [ 'path3', 'file3' ]); DESCRIPTION This module is a result of /me not wanting to write: if ($(stat('filename'))[9] < $(stat('tmp/other-filename'))[9]) { do_someting(); }; Instead I wrote a module with ~80 lines of code and ~90 lines of tests for it... So how is the module different from the above "if"? Should be reusable, has more functionality, should be clear from the code it self what the condition is doing and was fun to play with it. Another advantage is that the file names can be passed as array refs. In this case "catfile" in File::Spec is used to construct the filename. The resulting code is: if (File::is->older('filename', [ 'tmp', 'other-filename' ])) { do_something(); }; FUNCTIONS newer($primary_filename, $other_filename, $other_filename2, ...) Returns true/false if the $primary_filename is newer (has modification time-stamp recent) then any of the rest passed as argument. newest($primary_filename, $other_filename, $other_filename2, ...) Returns true/false if the $primary_filename is newest (has the biggest modification time-stamp) compared to the rest of the passed filenames. older($primary_filename, $other_filename, $other_filename2, ...) Returns true/false if the $primary_filename is older (has the later modification time-stamp) then any of the rest passed as argument. oldest($primary_filename, $other_filename, $other_filename2, ...) Returns true/false if the $primary_filename is oldest (has the latest modification time-stamp) compared to the rest of the passed filenames. similar($primary_filename, $other_filename, $other_filename2, ...) Returns true/false if the $primary_filename has the same size and modification time-stamp than any of the rest of the passed filenames. thesame($primary_filename, $other_filename, $other_filename2, ...) Returns true/false if the $primary_filename has the same inode (is hard link) to any of the rest of the passed filenames. bigger($primary_filename, $other_filename, $other_filename2, ...) Returns true/false if the $primary_filename is bigger (has the bigger size) then any of the rest passed as argument. biggest($primary_filename, $other_filename, $other_filename2, ...) Returns true/false if the $primary_filename is biggest (has the biggest size) compared to the rest of the passed filenames. smaller($primary_filename, $other_filename, $other_filename2, ...) Returns true/false if the $primary_filename is smaller (has the smaller size) then any of the rest passed as argument. smallest($primary_filename, $other_filename, $other_filename2, ...) Returns true/false if the $primary_filename is smallest (has the smallest size) compared to the rest of the passed filenames. INTERNALS Call/use at your own risk ;-) _construct_filename() Accepts one or more arguments. It passes them to "> dereferencing the array if one argument array ref is passed. Example: _construct_filename('file') => 'file' _construct_filename([ 'folder', 'file' ]) => File::Spec->catfile('folder', 'file'); _construct_filename('folder', 'file') => File::Spec->catfile('folder', 'file'); This function is called on every argument passed to cmp methods (newer, smaller, older, ...). _cmp_stat($class, $return_value_if_match, $cmp_function, $primary_filename, $other_filename, $other_filename2, ...) This function is called by all of the public "newer()", "smaller()", "older()", ... methods do loop through files and do some cmp on them. AUTHOR Jozef Kutej, "" BUGS Please report any bugs or feature requests to "bug-file-is at rt.cpan.org", or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. SUPPORT You can find documentation for this module with the perldoc command. perldoc File::is You can also look for information at: * RT: CPAN's request tracker * AnnoCPAN: Annotated CPAN documentation * CPAN Ratings * Search CPAN COPYRIGHT Copyright 2009 Jozef Kutej, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.