my @parts = File::Spec->splitdir(Cwd::realpath($path)); my $home = $self->{_home}; for my $last (reverse 0..$#parts) { ... return undef unless(($uid == $> or $uid == 0 ) and (($mode & 022) == 0)); return 1 if (defined $home and $home eq $dir);