[Wellington-pm] File tests
Cliff Pratt
enkidu at cliffp.com
Tue Nov 4 01:43:20 PST 2008
Duh! That's exactly what it was. I created the link as follows:
ln -s Y/C.file Y/ZZ
I ran this in the directory *above* Y of course and what it creates in Y is:
lrwxrwxrwx 1 cliffp cliffp 15 2008-11-04 22:30 ZZ -> Y/C.file
And in the Y directory there is no Y directory with a file called C.file.
Cheers,
Cliff
Martyn Smith wrote:
> Hmm, it certainly seems to work for me :-) (i.e. the -e test returns true
> for a valid link).
>
> Are you sure the link Y/ZZ isn't pointing to a file that doesn't exist?
> (i.e. are you sure it's not a broken symlink?)
>
> On Mon, Nov 03, 2008 at 10:47:47PM +1300, Cliff Pratt wrote:
>> If $dir = Y is a directory and exists then the following snippet prints
>> nothing (as desired and expected). If $dir = Y/ZZ exists and is a link
>> I get 'File or directory "Y/ZZ" does not exist'. I'd rather it prints
>> nothing.
>>
>> Obviously I'm missing something. But what?
>>
>> Cheers,
>>
>> Cliff
>>
>> if ( ! -e "$dir" )
>> {
>> $self->{error_msg} = "File or directory \"$dir\" does not exist." ;
>> $self->{error} = 'true' ;
>> print "$self->{error_msg}\n" ;
>> return 1 ;
>> }
More information about the Wellington-pm
mailing list