Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^3: How to get file owner name?

by narainhere (Monk)
on Sep 10, 2007 at 11:01 UTC ( #638027=note: print w/replies, xml ) Need Help??

in reply to Re^2: How to get file owner name?
in thread How to get file owner name?

use File::stat; use User::pwent;
Should I Install the User::pwent module for the code to work?
I am getting the error "The getpwuid function is unimplemented"

The world is so big for any individual to conquer

Replies are listed 'Best First'.
Re^4: How to get file owner name?
by Fletch (Chancellor) on Sep 10, 2007 at 12:51 UTC

    getpwuid is a *NIX/POSIX-ism. Odds are you're on an OS which isn't (or which makes a very poor showing of) POSIX-compatible (e.g. Windows).

      And if you are on Win32 (which doesn't appear to be the case since the OP says it worked) then I'll just point out that the Win32 permissions model doesn't map to the POSIX -rwxrwxrwx model. At all.

      For instance, people don't really "own" files (well they do), it's more that you have people (accounts) and groups on one side, and files on the other, and what the former may do to the latter is governed by relations established between the two.

      The module Win32::Perms is a useful module to deal with manipulating Windows permissions. Note that it's not on CPAN, which means it misses out on smoke testing and so forth. For instance, to get the owner of a filename, it looks like this:

      my $username = Win32::Perms->new($filename)->Owner;

      • another intruder with the mooring in the heart of the Perl

Re^4: How to get file owner name?
by trek1s (Scribe) on Sep 10, 2007 at 12:13 UTC
    I'm not loading any additional module (just "use strict;"), it does not seem to be necessary.

    Which version of Perl are you using?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://638027]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2018-01-24 08:31 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (256 votes). Check out past polls.