Okay, I'm going out on a limb (?) here, but, shouldn't
Perl hide that from you ? (Sarcastic, ofcourse it does)
Don't know much about MacPerl, but I think you just
be able to use 'stat' ... And if not *I* think you should
..wait...
oh... I love Google... found this:
#!perl
# Script to test MacPerl stat() and file test operators
foreach $f (@ARGV) {
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($f);
print "\nstat() call on [$f]-------------------->\n";
print "dev =$dev\n";
print "ino =$ino\n";
print "mode =$mode\n";
print "nlink =$nlink\n";
print "uid =$uid\n";
print "gid =$gid\n";
print "rdev =$rdev\n";
print "size =$size\n";
print "atime =$atime\n";
print "mtime =$mtime\n";
print "ctime =$ctime\n";
print "blksize=$blksize\n";
print "blocks =$blocks\n";
print "\nFile test results:\n";
print "-r test (Readable by effective uid) = [". (-r
+$f) . "]\n";
print "-w test (Writable by effective uid) = [". (-w
+$f) . "]\n";
print "-x test (Executable by effective uid) = [". (-x
+$f) . "]\n";
print "-o test (Owned by effective uid) = [". (-o
+$f) . "]\n";
print "-R test (Readable by real uid) = [". (-R
+$f) . "]\n";
print "-W test (Writable by real uid) = [". (-W
+$f) . "]\n";
print "-X test (Executable by real uid) = [". (-X
+$f) . "]\n";
print "-O test (Owned by real uid) = [". (-O
+$f) . "]\n";
print "-e test (File exists) = [". (-e
+$f) . "]\n";
print "-z test (File has zero size) = [". (-z
+$f) . "]\n";
print "-s test (File has non-zero size) = [". (-s
+$f) . "]\n";
print "-f test (File is a plain file) = [". (-f
+$f) . "]\n";
print "-d test (File is a directory) = [". (-d
+$f) . "]\n";
print "-l test (File is a symbolic link ie. a Finder alias) = [". (-l
+$f) . "]\n";
print "-S test (File is a socket handle) = [". (-S
+$f) . "]\n";
print "-p test (File is a named pipe) = [". (-p
+$f) . "]\n";
print "-b test (File is a block special file) = [". (-b
+$f) . "]\n";
print "-c test (File is a char special file) = [". (-c
+$f) . "]\n";
print "-u test (File has setuid bit set) = [". (-u
+$f) . "]\n";
print "-g test (File has setgid bit set) = [". (-g
+$f) . "]\n";
print "-k test (File has sticky bit set) = [". (-k
+$f) . "]\n";
print "-t test (Filehandle opened to a tty eg.Dev:Console) = [". (-t
+$f) . "]\n";
print "-T test (File is a TEXT file) = [". (-T
+$f) . "]\n";
print "-B test (File is a BINARY file) = [". (-B
+$f) . "]\n";
print "-M test (Unix: Age; Mac: Last modified; \n";
print " both in days since script executed) = [". (-M
+$f) . "]\n";
print "-A test (Unix: Access, as per -M; Mac: as per -M) = [". (-A
+$f) . "]\n";
print "-C test (Unix: Inode changed, as per -M;\n";
print " Mac: Created; both in days)) = [". (-C
+$f) . "]\n";
($creator, $type) = &MacPerl'GetFileInfo($f);
print "\nMac creator=[$creator] Mac type=[$type]\n";
}
Hmmm just searched for "Perl Mac stat" on google, do
you have Internet there ?
GreetZ!,
p.s. From PerlPort on 'stat':
mtime and atime are the same thing, and ctime is creation time instead of inode change time. (Mac OS) | [reply] [d/l] |
MacPerlMan to the rescue!
Ouchy! While that other guy's solution is OK (I guess), you're missing out on alot o' Mac specific data. Also, if you get involved with the date returned above, it'll be seconds since th UN*X epoch which you're not really interested in on any Mac System. Solution: use Mac::Files or Mac::MoreFiles (I didn't name them and remember "or" is not mutually exclusive). Here's some quick code to give you the idea (read the PODs on Mac::Files at least, though).
use Mac::Files; #along with strict and -wT
my $file="AgentM\'s Rockin\' G4 Cube:Desktop Folder:FileSupafly";
my $cat=FSpGetCatInfo($file); #throw in some dies along here
my $fileinfo=$cat->ioFlFndrInfo();
print $filecat->ioNamePtr(), ' ',$fileinfo->fdCreator(); #prints filen
+ame and its 4 letter creator type
These modules also include numerous (read "gazillions o' ") constants that help you toy with the filesystem: comments, resource stuff, etc. This was just a striptease of what these modules are really capable of: file locking, resource editing, directory info, etc.
I, too, realize that the PODs are all too often inadequate but I take what I can get- including the MacPerl book which you can get anywhere online.
Please- while using MacPerl, keep you tray table up and your seat in the upright and locked position. Thank you.
AgentM Systems nor Nasca Enterprises nor
Bone::Easy nor Macperl is responsible for the
comments made by
AgentM. Remember, you can build any logical system with NOR.
| [reply] [d/l] |