File::CheckTree(3pm)
πΈ NAME πΈ
File::CheckTree β run so many filetest checks on a whole tree, bestie π
β¨ SYNOPSIS β¨
use File::CheckTree;
$num_warnings = validate( q{
/vmunix -e || die
/boot -e || die
/bin cd
csh -ex
csh !-ug
sh -ex
sh !-ug
/usr -d || warn "What happened to $file?\n"
});
π¦ DESCRIPTION π¦
okay so the validate() routine takes one single multiline string made up of directives, and each directive is a filename plus a file test to throw at it. that's it. that's the whole vibe. π
(plot twist tho: the file test can also be a cd, which makes all the relative filenames after it get interpreted relative to that directory. it's giving "we're moving in, pack up the paths" π
)
after the file test, you can drop a || die in there to make it a fatal error if that file test flops. and if you don't say anything? the default is || warn. no cap. π
you can also prepend a ! to the file test to test for the opposite condition β like, "hey, this better NOT be true." iconically petty, we love her.
if you do a cd and then list some relative filenames, you lowkey might wanna indent them a little for readability. purely aesthetic, but slay. β¨
and if you supply your own die() or warn() message? you can use $file to interpolate the filename right into it. chef's kiss. π€
π§ Filetests may be bunched
Like, literally group them: -rwx tests for all of -r, -w, and -x in one go. efficient queen. π
β οΈ heads up tho: only the first failed test of the bunch will actually produce a warning. the rest just sit there quietly. π
The routine returns the number of warnings issued. that's your receipt, bestie. π§Ύ
π AUTHOR π
File::CheckTree was derived from lib/validate.pl, which was written by Larry Wall. Then it got revised by Paul Grassie <grassie@perl.com> in 2002. legends only. π«Ά
π HISTORY π
okay storytime, gather round π
- File::CheckTree used to not display fatal error messages. like, at all. not me finding out your fatal error was silent the whole time π
- it also used to count only those warnings produced by a generic
|| warnβ and not the ones where the user supplied the message. rude honestly. - and on top of all that? the
validate()routine would leave your user program sitting in whatever directory was last entered through the use ofcddirectives. bro it just left you there. no navigation home. π
These bugs were fixed during the development of perl 5.8. The first fixed version of File::CheckTree was 4.2. periodt. π
that's the whole page, bestie β this came to you from perl v5.36.0, dated 2022-10-13, and honestly? she ate. stay validated out there, mwah ππβ¨
π¦ where this page comes from
- ubuntu noble: libfile-checktree-perl 4.42-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libfile-checktree-perl 4.42-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libfile-checktree-perl 4.42-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms