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

Re: [MacPerl] Problem with -l file test



On Thu, May 11, 2000 at 07:10:01PM -0500, J.O'Dell wrote:
> I've been working my way through MPPE, and I'm pretty new at this,
> apologies in advance if I overlooked something obvious.  I'm working on a
> script to use as a droplet that will take either a folder or files and do
> "stuff".  I want to skip aliases that might be in the directories.  While
> using the file tests for file, directory and alias, 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.
Why not just put the -l test before the -f test?


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


Ronald

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