[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Problem with -l file test



On Fri, May 12, 2000 at 08:56:57AM -0500, J.O'Dell wrote:
> [snip]
> 
> >>aliases are reported as
> >> files, whether I test the filename or the filespec.   It almost looks as
> >> though it is resolving the alias before it is doing the file test.   I
> >> could screen for aliases using Applescript, but I'd rather "just use
> >> Perl".....
> >
> >That's the way the file test operators are supposed to work.
> 
> [newbie registers confusion here]
> I thought the file tests were to distiguish between types of file objects
> (terminolgy almost certainly incorrect).  A directory, to my human mind, is
> distinct from a file which is distinct from an alias (which is a
> "reference" in one location to a file in a different location).
> 

An alias can be an alias to a file or a directory, so an alias can be both
an alias and a file, or both an alias and a directory.  Only some of the
types are mutually exclusive; an item can't be both a file and a directory.

The documentation should be cleaer on this point.


> 	if (-l $item) {
> 		print ("$item is a file\n");
> 	} elsif (-d $item) {
> 		print ("$item is a directory\n");
> 	} elsif (-f $item) {
> 		print ("$item is an alias\n");
> 	} else {
> 		print ("$item is not a directory, file, or alias\n");
> 	}

>  and the output now is:
> Zoot:Trash alias is a file
> FFFF00000002:Trash is a directory
> 
> What I guess I'm not following is why the test does not identify the alias
> as such.

It did.  Your output messages are backwards.  :)

Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org