File Coverage

blib/lib/BSD/Itimer.pm
Criterion Covered Total %
statement 30 34 88.2
branch 3 8 37.5
condition n/a
subroutine 9 9 100.0
pod n/a
total 42 51 82.3


line stmt bran cond sub pod time code
1             # File: Itimer.pm
2             # Author: Daniel Hagerty, hag@linnaean.org
3             # Date: Sun Jul 4 17:05:49 1999
4             # Description: Perl interface to BSD derived {g,s}etitimer functions
5             #
6             # Copyright (c) 1999 Daniel Hagerty. All rights reserved. This program
7             # is free software; you can redistribute it and/or modify it under the
8             # same terms as Perl itself.
9             #
10             # $Id: Itimer.pm,v 1.1 1999/07/06 02:56:10 hag Exp $
11              
12             package BSD::Itimer;
13              
14 1     1   871 use strict;
  1         2  
  1         38  
15 1     1   4 use Carp;
  1         2  
  1         93  
16              
17 1     1   5 use Exporter;
  1         9  
  1         85  
18 1     1   5 use DynaLoader;
  1         2  
  1         172  
19 1     1   1448 use AutoLoader;
  1         2520  
  1         7  
20              
21 1     1   42 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
  1         2  
  1         528  
22              
23             ###
24              
25             # This version number is incremented explicitly by the human.
26             $VERSION = '0.8';
27              
28             @ISA = qw(Exporter DynaLoader);
29             # Items to export into callers namespace by default. Note: do not export
30             # names by default without a very good reason. Use EXPORT_OK instead.
31             # Do not simply export all your public functions/methods/constants.
32             @EXPORT = qw(
33             ITIMER_PROF
34             ITIMER_REAL
35             ITIMER_REALPROF
36             ITIMER_VIRTUAL
37             getitimer
38             setitimer
39             );
40              
41             sub AUTOLOAD {
42             # This AUTOLOAD is used to 'autoload' constants from the constant()
43             # XS function. If a constant is not found then control is passed
44             # to the AUTOLOAD in AutoLoader.
45              
46 1     1   40 my $constname;
47 1         7 ($constname = $AUTOLOAD) =~ s/.*:://;
48 1 50       4 croak "& not defined" if $constname eq 'constant';
49 1 50       8 my $val = constant($constname, @_ ? $_[0] : 0);
50 1 50       4 if ($! != 0) {
51 0 0       0 if ($! =~ /Invalid/) {
52 0         0 $AutoLoader::AUTOLOAD = $AUTOLOAD;
53 0         0 goto &AutoLoader::AUTOLOAD;
54             }
55             else {
56 0         0 croak "Your vendor has not defined BSD::Itimer macro $constname";
57             }
58             }
59             {
60 1     1   7 no strict "refs";
  1         3  
  1         112  
  1         3  
61 1     3   8 *$AUTOLOAD = sub { $val };
  3         74  
62             }
63 1         5 goto &$AUTOLOAD;
64             }
65              
66             bootstrap BSD::Itimer $VERSION;
67              
68             # Preloaded methods go here.
69              
70             # Autoload methods go after =cut, and are processed by the autosplit program.
71              
72             1;
73             __END__