Note that permissions on all of the ancestor directories also matter.
To aid in diagnosing the problem, you might want to do something like the following:
my $dir = '/home/bla/public_html/blabla';
my $isDir = -d $dir;
if( $isDir ) {
print "Found directory: $dir\n";
} elsif( defined $isDir ) {
print "Found non-directory: $dir\n";
} else {
print "Can't stat($dir): $!\n";
}
That way you can distinguish between "permission denied" vs "no such file/dir" vs something more exotic. The next step narrows down the source of the problem:
use File::Basename 'dirname';
my $dir = '/home/bla/public_html/blabla';
my $isDir;
while( ! defined $isDir ) {
my $isDir = -d $dir;
if( $isDir ) {
print "Found directory: $dir\n";
} elsif( defined $isDir ) {
print "Found non-directory: $dir\n";
} else {
print "Can't stat($dir): $!\n";
}
last
if '/' eq $dir;
$dir = dirname( $dir );
}
|