summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/lib/File/CheckTree.pm
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2008-09-29 17:35:51 +0000
committermillert <millert@openbsd.org>2008-09-29 17:35:51 +0000
commit7bfa9f444b545f1bc96a4b2919ed2583bf07c7ea (patch)
treea27ed65c25e4fb26d9bca8126dbdf2b189894d6a /gnu/usr.bin/perl/lib/File/CheckTree.pm
parentimport perl 5.10.0 from CPAN (diff)
downloadwireguard-openbsd-7bfa9f444b545f1bc96a4b2919ed2583bf07c7ea.tar.xz
wireguard-openbsd-7bfa9f444b545f1bc96a4b2919ed2583bf07c7ea.zip
fix conflicts and merge in local changes to perl 5.10.0
Diffstat (limited to 'gnu/usr.bin/perl/lib/File/CheckTree.pm')
-rw-r--r--gnu/usr.bin/perl/lib/File/CheckTree.pm19
1 files changed, 14 insertions, 5 deletions
diff --git a/gnu/usr.bin/perl/lib/File/CheckTree.pm b/gnu/usr.bin/perl/lib/File/CheckTree.pm
index 20ffd68124d..29f05d8a0fc 100644
--- a/gnu/usr.bin/perl/lib/File/CheckTree.pm
+++ b/gnu/usr.bin/perl/lib/File/CheckTree.pm
@@ -13,7 +13,7 @@ our @EXPORT = qw(validate);
=head1 NAME
-validate - run many filetest checks on a tree
+File::CheckTree - run many filetest checks on a tree
=head1 SYNOPSIS
@@ -87,8 +87,17 @@ sub validate {
# but earlier versions of File::CheckTree did not do this either
# split a line like "/foo -r || die"
- # so that $file is "/foo", $test is "-rwx || die"
- ($file, $test) = split(' ', $check, 2); # special whitespace split
+ # so that $file is "/foo", $test is "-r || die"
+ # (making special allowance for quoted filenames).
+ if ($check =~ m/^\s*"([^"]+)"\s+(.*?)\s*$/ or
+ $check =~ m/^\s*'([^']+)'\s+(.*?)\s*$/ or
+ $check =~ m/^\s*(\S+?)\s+(\S.*?)\s*$/)
+ {
+ ($file, $test) = ($1,$2);
+ }
+ else {
+ die "Malformed line: '$check'";
+ };
# change a $test like "!-ug || die" to "!-Z || die",
# capturing the bundled tests (e.g. "ug") in $2
@@ -155,12 +164,12 @@ sub validate {
eval $this;
# re-raise an exception caused by a "... || die" test
- if ($@) {
+ if (my $err = $@) {
# in case of any cd directives, return from whence we came
if ($starting_dir ne cwd) {
chdir($starting_dir) || die "$starting_dir: $!";
}
- die $@ if $@;
+ die $err;
}
}