This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.001 patch.1e
[perl5.git] / pod / modpods / CheckTree.pod
1 =head1 NAME
2
3 validate - run many filetest checks on a tree
4
5 =head1 SYNOPSIS
6
7     use File::CheckTree;
8
9     $warnings += validate( q{
10         /vmunix                 -e || die
11         /boot                   -e || die
12         /bin                    cd
13             csh                 -ex
14             csh                 !-ug
15             sh                  -ex
16             sh                  !-ug
17         /usr                    -d || warn "What happened to $file?\n"
18     });
19
20 =head1 DESCRIPTION
21
22 The validate() routine takes a single multiline string consisting of
23 lines containing a filename plus a file test to try on it.  (The
24 file test may also be a "cd", causing subsequent relative filenames
25 to be interpreted relative to that directory.)  After the file test
26 you may put C<|| die> to make it a fatal error if the file test fails.
27 The default is C<|| warn>.  The file test may optionally have a "!' prepended
28 to test for the opposite condition.  If you do a cd and then list some
29 relative filenames, you may want to indent them slightly for readability.
30 If you supply your own die() or warn() message, you can use $file to
31 interpolate the filename.
32
33 Filetests may be bunched:  "-rwx" tests for all of C<-r>, C<-w>, and C<-x>.
34 Only the first failed test of the bunch will produce a warning.
35
36 The routine returns the number of warnings issued.
37