in reply to Re^2: Problem with directory path checking
in thread Problem with directory path checking

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_ht­ml/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_ht­ml/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 ); }

- tye        

Replies are listed 'Best First'.
Re^4: Problem with directory path checking ($!)
by Anonymous Monk on Jan 12, 2012 at 07:32 UTC

    I have a question, is 0xAD part of your $dir?

    I see

    00000030: 62 6C 61 AD 2F 70 75 62 - 6C 69 63 5F 68 74 AD 6D |bla /publ +ic_ht m|