[Chapter 3] 3.2.50 getlogin

Programming Perl

Programming PerlSearch this book
Previous: 3.2.49 gethostentChapter 3
Functions
Next: 3.2.51 getnetbyaddr
 

3.2.50 getlogin

getlogin

This function returns the current login from /etc/utmp, if any. If null, use getpwuid. For example:

$login = getlogin || (getpwuid($<))[0] || "Intruder!!";


Previous: 3.2.49 gethostentProgramming PerlNext: 3.2.51 getnetbyaddr
3.2.49 gethostentBook Index3.2.51 getnetbyaddr