1File::CheckTree(3pm) Perl Programmers Reference Guide File::CheckTree(3pm)
2
3
4
6 validate - 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 file‐
26 names to be interpreted relative to that directory.) After the file
27 test you may put "⎪⎪ die" to make it a fatal error if the file test
28 fails. The default is "⎪⎪ warn". The file test may optionally have a
29 "!' prepended to test for the opposite condition. If you do a cd and
30 then list some relative filenames, you may want to indent them slightly
31 for readability. If you supply your own die() or warn() message, you
32 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 vali‐
47 date() routine would leave the user program in whatever directory was
48 last entered through the use of "cd" directives. These bugs were fixed
49 during the development of perl 5.8. The first fixed version of
50 File::CheckTree was 4.2.
51
52
53
54perl v5.8.8 2001-09-21 File::CheckTree(3pm)