File Coverage

blib/lib/Unix/Sysexits.pm
Criterion Covered Total %
statement 28 29 96.5
branch 2 4 50.0
condition n/a
subroutine 8 8 100.0
pod n/a
total 38 41 92.6


line stmt bran cond sub pod time code
1             # -*- Perl -*-
2              
3             package Unix::Sysexits;
4              
5 1     1   62735 use 5.006000;
  1         3  
  1         41  
6 1     1   7 use strict;
  1         2  
  1         76  
7 1     1   15 use warnings;
  1         19  
  1         79  
8 1     1   5 use Carp;
  1         2  
  1         165  
9              
10             require Exporter;
11 1     1   294340 use AutoLoader;
  1         2069  
  1         8  
12              
13             our @ISA = qw(Exporter);
14              
15             our @EXPORT = qw(
16             EX_CANTCREAT
17             EX_CONFIG
18             EX_DATAERR
19             EX_IOERR
20             EX_NOHOST
21             EX_NOINPUT
22             EX_NOPERM
23             EX_NOUSER
24             EX_OK
25             EX_OSERR
26             EX_OSFILE
27             EX_PROTOCOL
28             EX_SOFTWARE
29             EX_TEMPFAIL
30             EX_UNAVAILABLE
31             EX_USAGE
32             EX__BASE
33             EX__MAX
34             );
35              
36             our $VERSION = '0.05';
37              
38             sub AUTOLOAD {
39             # This AUTOLOAD is used to 'autoload' constants from the constant()
40             # XS function.
41              
42 18     18   756 my $constname;
43 18         15 our $AUTOLOAD;
44 18         61 ($constname = $AUTOLOAD) =~ s/.*:://;
45 18 50       37 croak "&Unix::Sysexits::constant not defined" if $constname eq 'constant';
46 18         42 my ($error, $val) = constant($constname);
47 18 50       29 if ($error) { croak $error; }
  0         0  
48             {
49 1     1   281 no strict 'refs';
  1         3  
  1         110  
  18         17  
50             # Fixed between 5.005_53 and 5.005_61
51             #XXX if ($] >= 5.00561) {
52             #XXX *$AUTOLOAD = sub () { $val };
53             #XXX }
54             #XXX else {
55 18     18   75 *$AUTOLOAD = sub { $val };
  18         217  
56             #XXX }
57             }
58 18         51 goto &$AUTOLOAD;
59             }
60              
61             require XSLoader;
62             XSLoader::load('Unix::Sysexits', $VERSION);
63              
64             # Preloaded methods go here.
65              
66             # Autoload methods go after =cut, and are processed by the autosplit program.
67              
68             1;
69             __END__