On Aug 16, Rus Foster said:

>On Fri, 16 Aug 2002 [EMAIL PROTECTED] wrote:
>
>> Hello,
>> does anybody know a possibility how to ascertain the current User (User Id,
>> Username) ?
>> I thougt of using a module but couldn't find one.
>
>Have you tired parsing the output from the commands "id -h" and "id -u"?

Perl is not the shell.  You shouldn't have to spawn (OS-specific!)
programs every time you want to get information from the system.

For example, directory listings can be done with glob() or readdir() --
there's no need to call `ls` or `dir`.

Perl puts the current user ID in $< (or $UID if you're using the English
module).  You can get information about that user ID from the getpwuid()
function.

  perldoc -f getpwuid

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to