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

Re: [MacPerl] Problem with -l file test



[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).

>Why not just put the -l test before the -f test?
>

Now when I do that I get the following results:
code fragment: (where $item is the name of an alias and $fsitem =
MacPerl::MakeFSSpec($item))
	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");
	}
	if (-l $fsItem) {
		print ("$fsItem is a file\n");
	} elsif (-d $fsItem) {
		print ("$fsItem is a directory\n");
	} elsif (-f $fsItem) {
		print ("$fsItem is an alias\n");
	} else {
		print ("$fsItem 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 makes sense that the ORDER in which the test is performed
would change the result, but not the fact that it is calling the alias a
file.  Or am I totally misreading what -l is supposed to do?

Jane


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