Runs file tests on a set of files. Exports one function,
validate
, which takes a single multi-line string as input. Each
line of the string contains a filename plus a test to run on the file.
The test can be followed with
|| die
to make it a fatal error if
it fails. The default is
|| warn
. Prepending
!
to the
test reverses the sense of the test. You can group tests (e.g.,
-rwx
);
only the first failed test of the group produces a warning. For example:
use File::CheckTree;
$warnings += validate( q{
/vmunix -e || die
/bin cd
csh !-ug
sh -ex
/usr -d || warn "What happened to $file?\n"
});
Available tests include all the standard Perl file-test operators except
-t
,
-M
,
-A
, and
-C
.
Unless it dies,
validate
returns the number of warnings issued.