Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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]
[1nickt]: ... choice, the threaded-perl user *probably* wants to use threads, therefore only require threads and leave MCE out, allowing the user to manually install if desired?
[choroba]: just require any of MCE and threads. Not sure if that's possible in the cpanfile, but should be possible early in the Makefile
[1nickt]: The app expects threads as default anyway, right?
[choroba]: that's true
[1nickt]: expects threads *to be* the default
[1nickt]: I think cpanfile can handle the logic. testing now.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (14)
As of 2017-10-18 13:26 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (244 votes). Check out past polls.