in reply to stat & uid

If this is on a *nix system and you have read access to /etc/passwd (probably you're either root, or the system uses a shadow file) you could load it into an array and 'grep /^$uid/, @passwd_file_listing' then '$uuid = split /:/, @array_you_put_grep_output_into'...

Replies are listed 'Best First'.
Re^2: stat & uid
by tc1364 (Beadle) on Jul 13, 2005 at 21:24 UTC
    ty
      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...

        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. :-)