File Coverage

blib/lib/User/Utmp.pm
Criterion Covered Total %
statement 17 21 80.9
branch 2 6 33.3
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 27 35 77.1


line stmt bran cond sub pod time code
1             # @(#) $Id: Utmp.pm 1.1.1.3 Mon, 27 Mar 2006 02:20:00 +0200 mxp $
2              
3             package User::Utmp;
4              
5 1     1   9098 use strict;
  1         3  
  1         44  
6 1     1   6 use Carp;
  1         2  
  1         113  
7 1     1   6 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $AUTOLOAD);
  1         4  
  1         487  
8              
9             require Exporter;
10             require DynaLoader;
11             require AutoLoader;
12              
13             @ISA = qw(Exporter DynaLoader);
14             # Items to export into callers namespace by default. Note: do not export
15             # names by default without a very good reason. Use EXPORT_OK instead.
16             # Do not simply export all your public functions/methods/constants.
17             @EXPORT_OK = qw(setutent getut putut utmpname
18             setutxent endutxent getutxid getutxline getutxent pututxline
19             utmpxname getutx
20             HAS_UTMPX
21             UTMP_FILE UTMPX_FILE WTMP_FILE WTMPX_FILE
22             BOOT_TIME
23             DEAD_PROCESS
24             EMPTY
25             INIT_PROCESS
26             LOGIN_PROCESS
27             NEW_TIME
28             OLD_TIME
29             RUN_LVL
30             USER_PROCESS);
31             @EXPORT = ();
32             %EXPORT_TAGS = (utmp => [qw(getut putut utmpname)],
33             utmpx => [qw(setutxent endutxent getutxid getutxline getutxent
34             pututxline utmpxname getutx)],
35             constants => [qw(HAS_UTMPX
36             UTMP_FILE UTMPX_FILE WTMP_FILE WTMPX_FILE
37             BOOT_TIME
38             DEAD_PROCESS
39             EMPTY
40             INIT_PROCESS
41             LOGIN_PROCESS
42             NEW_TIME
43             OLD_TIME
44             RUN_LVL
45             USER_PROCESS)]);
46             # $Format: "$VERSION='$ProjectVersion$';"$
47             $VERSION='1.8';
48              
49             sub AUTOLOAD {
50             # This AUTOLOAD is used to 'autoload' constants from the constant()
51             # XS function. If a constant is not found then control is passed
52             # to the AUTOLOAD in AutoLoader.
53              
54 2     2   1624 my $constname;
55 2         17 ($constname = $AUTOLOAD) =~ s/.*:://;
56 2 50       15 my $val = constant($constname, @_ ? $_[0] : 0);
57 2 50       12 if ($! != 0) {
58 0 0       0 if ($! =~ /Invalid/) {
59 0         0 $AutoLoader::AUTOLOAD = $AUTOLOAD;
60 0         0 goto &AutoLoader::AUTOLOAD;
61             }
62             else {
63 0         0 croak "Your vendor has not defined User::Utmp macro $constname";
64             }
65             }
66 2     2 1 113 eval "sub $AUTOLOAD { $val }";
  2     3 1 246  
  3         423  
67 2         77 goto &$AUTOLOAD;
68             }
69              
70             bootstrap User::Utmp $VERSION;
71              
72             # Preloaded methods go here.
73              
74             # Autoload methods go after =cut, and are processed by the autosplit program.
75              
76             1;
77             __END__