NAME

User::Utmp - Perl access to utmp-style databases

SYNOPSIS

use User::Utmp;
utmpname("file");
@utmp = User::Utmp::getut();

DESCRIPTION

The following functions are provided:

getut()

Reads a utmp-like file and converts it to a Perl array of hashes. Each array element (a reference to a hash) represents one utmp record. The hash keys are the names of the elements of the utmp structure as described in utmp(4). The hash values are generally the same as in C, with the following exceptions: the value of ut_type is a string containing the name of the ut_type constant; the value of ut_addr is a string suitable as parameter to gethostbyname(); if the record doesn't describe a remote login ut_addr is the empty string.

utmpname()

Allows the user to change the name of the file being examined from /etc/utmp to any other file. In this case, the name provided to utmpname() will be used for the getut() function.

RESTRICTIONS

Reading the whole file into an array might not be the most efficient approach for potentially large files like /etc/wtmp.

This module is based on the traditional, non-reentrant utmp functions; it is therefore not thread-safe.

AUTHOR

Michael Piotrowski <mxp@linguistik.uni-erlangen.de>

SEE ALSO

utmp(4), getut(3)