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

I need to find the ownership of files on a server. A simple task on the unix side, but how do I glean that info while scripting in MacPerl?

The server is a sun running uShare so the file system visable from both the mac and irix.

Replies are listed 'Best First'.
Re: mac file ownership
by LD2 (Curate) on May 26, 2001 at 05:14 UTC
    I think that MacPerl::GetFileInfo should work.
    MacPerl::GetFileInfo(FILE) 
    In scalar context, returns the file type. In array context, returns (creator,type). Examples: 
        MacPerl::GetFileInfo(yin);
    
    
    Returns "TEXT" or ("MPS ", "TEXT"). 
    - From Macperl.
    You may want to look at this MacPerl Primer as well.

    good luck.
Re: mac file ownership
by Trimbach (Curate) on May 26, 2001 at 17:08 UTC
    Under the Mac Classic operating system (OS 9 and below) "ownership" doesn't mean anything. Mac Classic is NOT a multi-user operating system, so it isn't important for the system to keep track of which user owns which files. Because it isn't important, the system doesn't bother, hence, no Ownership. (There is a "Multi-user" setup in OS 9, but that determines "ownership" by location, that is, where the file is stored determines who it belongs to... but there is no file property that describes ownership like in UNIX.)

    Of course, this is completely different in Mac OS X. OS X is UNIX, and so each file has UNIX file permissions and ownership. You'd find the ownership of Mac OS X files using Perl just like you would on any other UNIX box.

    Gary Blackburn
    Trained Killer