ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы.



Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 8.68 File::BasenameChapter 8
Standard Modules
Next: 8.70 File::Compare
 

8.69 File::CheckTree

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.


Previous: 8.68 File::BasenamePerl in a NutshellNext: 8.70 File::Compare
8.68 File::BasenameBook Index8.70 File::Compare