1File::CheckTree(3) User Contributed Perl Documentation File::CheckTree(3)
2
3
4
6 File::CheckTree - run many filetest checks on a tree
7
9 use File::CheckTree;
10
11 $num_warnings = validate( q{
12 /vmunix -e || die
13 /boot -e || die
14 /bin cd
15 csh -ex
16 csh !-ug
17 sh -ex
18 sh !-ug
19 /usr -d || warn "What happened to $file?\n"
20 });
21
23 The validate() routine takes a single multiline string consisting of
24 directives, each containing a filename plus a file test to try on it.
25 (The file test may also be a "cd", causing subsequent relative
26 filenames to be interpreted relative to that directory.) After the
27 file test you may put "|| die" to make it a fatal error if the file
28 test fails. The default is "|| warn". The file test may optionally
29 have a "!' prepended to test for the opposite condition. If you do a
30 cd and then list some relative filenames, you may want to indent them
31 slightly for readability. If you supply your own die() or warn()
32 message, you can use $file to interpolate the filename.
33
34 Filetests may be bunched: "-rwx" tests for all of "-r", "-w", and
35 "-x". Only the first failed test of the bunch will produce a warning.
36
37 The routine returns the number of warnings issued.
38
40 File::CheckTree was derived from lib/validate.pl which was written by
41 Larry Wall. Revised by Paul Grassie <grassie@perl.com> in 2002.
42
44 File::CheckTree used to not display fatal error messages. It used to
45 count only those warnings produced by a generic "|| warn" (and not
46 those in which the user supplied the message). In addition, the
47 validate() routine would leave the user program in whatever directory
48 was last entered through the use of "cd" directives. These bugs were
49 fixed during the development of perl 5.8. The first fixed version of
50 File::CheckTree was 4.2.
51
52
53
54perl v5.28.1 2013-02-07 File::CheckTree(3)