NAME
Test::File -- test file attributes
SYNOPSIS
use Test::File;
DESCRIPTION
This modules provides a collection of test utilities for file attributes.
Some file attributes depend on the owner of the process testing the file in the same way the file test operators do. For instance, root (or super-user or Administrator) may always be able to read files no matter the permissions.
Some attributes don't make sense outside of Unix, either, so some tests automatically skip if they think they won't work on the platform. If you have a way to make these functions work on Windows, for instance, please send me a patch. :)
Functions
- file_exists_ok( FILENAME [, NAME ] )
-
Ok if the file exists, and not ok otherwise.
- file_not_exists_ok( FILENAME [, NAME ] )
-
Ok if the file does not exist, and not okay if it does exist.
- file_empty_ok( FILENAME [, NAME ] )
-
Ok if the file exists and has empty size, not ok if the file does not exist or exists with non-zero size.
- file_not_empty_ok( FILENAME [, NAME ] )
-
Ok if the file exists and has non-zero size, not ok if the file does not exist or exists with zero size.
- file_size_ok( FILENAME, SIZE [, NAME ] )
-
Ok if the file exists and has SIZE size in bytes (exactly), not ok if the file does not exist or exists with size other than SIZE.
- file_max_size_ok( FILENAME, MAX [, NAME ] )
-
Ok if the file exists and has size less than or equal to MAX bytes, not ok if the file does not exist or exists with size greater than MAX bytes.
- file_min_size_ok( FILENAME, MIN [, NAME ] )
-
Ok if the file exists and has size greater than or equal to MIN bytes, not ok if the file does not exist or exists with size less than MIN bytes.
- file_readable_ok( FILENAME [, NAME ] )
-
Ok if the file exists and is readable, not ok if the file does not exist or is not readable.
- file_not_readable_ok( FILENAME [, NAME ] )
-
Ok if the file exists and is not readable, not ok if the file does not exist or is readable.
- file_writeable_ok( FILENAME [, NAME ] )
-
Ok if the file exists and is writeable, not ok if the file does not exist or is not writeable.
- file_not_writeable_ok( FILENAME [, NAME ] )
-
Ok if the file exists and is not writeable, not ok if the file does not exist or is writeable.
- file_executable_ok( FILENAME [, NAME ] )
-
Ok if the file exists and is executable, not ok if the file does not exist or is not executable.
This test automatically skips if it thinks it is on a Windows platform.
- file_not_executable_ok( FILENAME [, NAME ] )
-
Ok if the file exists and is not executable, not ok if the file does not exist or is executable.
This test automatically skips if it thinks it is on a Windows platform.
- file_mode_is( FILENAME, MODE [, NAME ] )
-
Ok if the file exists and the mode matches, not ok if the file does not exist or the mode does not match.
This test automatically skips if it thinks it is on a Windows platform.
Contributed by Shawn Sorichetti <ssoriche@coloredblocks.net>
- file_mode_isnt( FILENAME, MODE [, NAME ] )
-
Ok if the file exists and mode does not match, not ok if the file does not exist or mode does match.
This test automatically skips if it thinks it is on a Windows platform.
Contributed by Shawn Sorichetti <ssoriche@coloredblocks.net>
TO DO
* check properties for other users (readable_by_root, for instance)
* check owner, group
* check times
* check number of links to file
* check path parts (directory, filename, extension)
SEE ALSO
SOURCE AVAILABILITY
This source is part of a SourceForge project which always has the latest sources in CVS, as well as all of the previous releases.
http://sourceforge.net/projects/brian-d-foy/
If, for some reason, I disappear from the world, one of the other members of the project can shepherd this module appropriately.
AUTHOR
brian d foy, <bdfoy@cpan.org>
COPYRIGHT
Copyright 2002-2005, brian d foy, All Rights Reserved
You may use, modify, and distribute this under the same terms as Perl itself.