in UNIX there functions that read thru the /etc/passwd, here are a few
examples:
$user = getpwuid($<); #gets username 
if you want the full name you can do something like:
($username = (getpwnam($user))[6]) =~ s/,,,//;#gcos field , strips out the
crud too

in windows I use the posix module:
use POSIX;
$user= getlogin;        #posix function to get user
gettin the user full name is a bit more work, take a look at the
Win32::AdminMisc package, you can read about it and get it here:
http://www.roth.net/perl/adminmisc/

HTH,
Jim





> -----Original Message-----
> From: Matija Papec [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 26, 2001 8:38 AM
> To: [EMAIL PROTECTED]
> Subject: whoami?
> 
> 
> 
> Greetings,
> 
> is there a more elegant way to find out who is running a 
> script? %ENV is
> not reliable and it doesn't contain USER when booting the system, and
> "whoami" is external command(yuck :) ) tnx!
> 
> 
> 
> --
> Matija
> 

Reply via email to