start page | rating of books | rating of authors | reviews | copyrights

Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 8.68 File::Basename Chapter 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::Basename Perl in a Nutshell Next: 8.70 File::Compare
8.68 File::Basename Book Index 8.70 File::Compare

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.