Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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


Comment on Re^3: How to get file owner name?
Download Code
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?

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://638027]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-11-22 15:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (123 votes), past polls