Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: stat & uid

by socketdave (Curate)
on Jul 13, 2005 at 21:45 UTC ( [id://474693]=note: print w/replies, xml ) Need Help??


in reply to Re^2: stat & uid
in thread stat & uid

tc1364, i'd advise you to use the function mentioned by davidrw. my solution will work, but it's ugly, slow and insecure in comparison. sorry about that...

Replies are listed 'Best First'.
Re^4: stat & uid
by Tanktalus (Canon) on Jul 13, 2005 at 22:17 UTC

    Let me tell you from experience - looking at /etc/passwd is badness. There are so many ways that someone may not be using /etc/password (NIS/NIS+, PAM, LDAP, ...) that ... well, just don't. By using the getpw* functions, you tap into the same C runtime library that the OS uses to validate logins. Which means you'll get the value as used on the system, and not some random value.

    It's just a good habit to get into. And, besides, File::stat and User::pwent are way too easy to use relative to grepping and spliting the /etc/passwd file. :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-26 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found