http://www.perlmonks.org?node_id=948885

wrinkles has asked for the wisdom of the Perl Monks concerning the following question:

On my mac (10.7) the file conditionals -f and -d and -e give false when the "@" attribute is present. I believe the "@" is used to mark files downloaded from the internet. How do I test these SOBs? TIA
Update: I tried Test::Dir with dir_exists_ok(), which returned "not ok" for the directories with the "@" attribute. I'm still open for suggestions...
#!/usr/bin/env perl use warnings; use strict; use 5.010; my @dirs; my $dh; opendir ($dh, '/home/setup_scripts/mt') or die "Cannot open dir - $!"; @dirs = grep {-d $_} readdir $dh ; print "@dirs \n"; close $dh; opendir ($dh, '/home/setup_scripts/mt') or die "Cannot open dir - $!"; @dirs = readdir $dh ; print "@dirs \n"; close $dh;
Output:
. .. . .. .DS_Store MTOS-4.37-en MTOS-4.37-en.zip
If I change "-d" to "-f" I see this:
.DS_Store . .. .DS_Store MTOS-4.37-en MTOS-4.37-en.zip
Using -e:
. .. .DS_Store . .. .DS_Store MTOS-4.37-en MTOS-4.37-en.zip
mac-pro:setup_scripts wrinkles$ ls -al mt total 11536 drwxr-xr-x 5 wrinkles staff 170 Jan 19 13:22 . drwxr-xr-x 12 wrinkles staff 408 Jan 19 20:32 .. -rw-r--r--@ 1 wrinkles staff 6148 Jan 19 20:04 .DS_Store drwxr-xr-x@ 29 wrinkles staff 986 Jun 21 2011 MTOS-4.37-en -rw-r--r--@ 1 wrinkles staff 5895060 Sep 3 22:22 MTOS-4.37-en.zip