.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Sys::Utmp 3pm" .TH Sys::Utmp 3pm "2013-10-29" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Sys::Utmp \- Object(ish) Interface to UTMP files. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Sys::Utmp; \& \& my $utmp = Sys::Utmp\->new(); \& \& while ( my $utent = $utmp\->getutent() ) \& { \& if ( $utent\->user_process ) \& { \& print $utent\->ut_user,"\en"; \& } \& } \& \& $utmp\->endutent; .Ve .PP See also examples/pwho in the distribution directory. .SH "DESCRIPTION" .IX Header "DESCRIPTION" Sys::Utmp provides a vaguely object oriented interface to the Unix user accounting file ( sometimes /etc/utmp or /var/run/utmp). Whilst it would prefer to use the \fIgetutent()\fR function from the systems C libraries it will attempt to provide its own if they are missing. .PP This may not be the module that you are looking for \- there is a User::Utmp which provides a different procedural interface and may well be more complete for your purposes. .SS "\s-1METHODS\s0" .IX Subsection "METHODS" .IP "new" 4 .IX Item "new" The constructor of the class. Arguments may be provided in Key => Value pairs : it currently takes one argument 'Filename' which will set the file which is to be used in place of that defined in _PATH_UTMP. .IP "getutent" 4 .IX Item "getutent" Iterates of the records in the utmp file returning a Sys::Utmp::Utent object for each record in turn \- the methods that are available on these objects are descrived in the Sys::Utmp::Utent documentation. If called in a list context it will return a list containing the elements of th Utent entry rather than an object. If the import flag ':fields' is used then constants defining the indexes into this list will be defined, these are uppercase versions of the methods described in Sys::Utmp::Utent. .IP "setutent" 4 .IX Item "setutent" Rewinds the file pointer on the utmp filehandle so repeated searches can be done. .IP "endutent" 4 .IX Item "endutent" Closes the file handle on the utmp file. .IP "utmpname \s-1SCALAR\s0 filename" 4 .IX Item "utmpname SCALAR filename" Sets the file that will be used in place of that defined in _PATH_UTMP. It is not defined what will happen if this is done between two calls to \&\fIgetutent()\fR \- it is recommended that \fIendutent()\fR is called first. .SS "\s-1EXPORT\s0" .IX Subsection "EXPORT" No methods or constants are exported by default. .SS "Exportable constants" .IX Subsection "Exportable constants" These constants are exportable under the tag ':constants': .PP .Vb 10 \& ACCOUNTING \& BOOT_TIME \& DEAD_PROCESS \& EMPTY \& INIT_PROCESS \& LOGIN_PROCESS \& NEW_TIME \& OLD_TIME \& RUN_LVL \& USER_PROCESS .Ve .PP These are the values that will be found in the ut_type field of the Sys::Utmp::Utent object. .PP These constants are exported under the tag ':fields' : .PP .Vb 7 \& UT_USER \& UT_ID \& UT_LINE \& UT_PID \& UT_TYPE \& UT_HOST \& UT_TIME .Ve .PP These provide the indexes into the list returned when \f(CW\*(C`getutent\*(C'\fR is called in list context. .SH "BUGS" .IX Header "BUGS" Probably. This module has been tested on Linux, Solaris, FreeBSD ,SCO Openserver and \s-1SCO\s0 UnixWare and found to work on those platforms. If you have difficulty building the module or it doesnt behave as expected then please contact the author including if appropriate your /usr/include/utmp.h .PP Patches to make this work better on any platform are always welcome. The source is managed at https://github.com/jonathanstowe/Sys\-Utmp so feel free to fork and send a pull request. .SH "AUTHOR" .IX Header "AUTHOR" Jonathan Stowe, .SH "LICENCE" .IX Header "LICENCE" This Software is Copyright Netscalibur \s-1UK 2001, \s0 Jonathan Stowe 2001\-2013 .PP This Software is published as-is with no warranty express or implied. .PP This is free software and can be distributed under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" perl. Sys::Utmp::Utent