User::Utmp CPAN Perl access to UNIX utmp(x)-style databases
This module provides a Perl interface to utmpx- and utmp-style databases on UNIX systems, the most important being "the utmpx file" (typically found at /var/run/utmpx, /etc/utmpx or a similar location), which provides information about users currently logged in. There is also support for writing records to utmpx and utmp files. For further details see the POD documentation embedded in the file Utmp.pm, which will also be installed as User::Utmp(3) manpage, and the example.pl script.