File Coverage

blib/lib/Unix/Uptime.pm
Criterion Covered Total %
statement 14 14 100.0
branch 3 4 75.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 21 23 91.3


line stmt bran cond sub pod time code
1             package Unix::Uptime;
2              
3 4     4   135304 use warnings;
  4         6  
  4         166  
4 4     4   22 use strict;
  4         5  
  4         1319  
5              
6             our $VERSION='0.36';
7             $VERSION = eval $VERSION;
8              
9             my %modules = (
10             freebsd => 'FreeBSD',
11             dragonfly => 'FreeBSD',
12             linux => 'Linux',
13             openbsd => 'BSD',
14             darwin => 'BSD',
15             netbsd => 'BSD',
16             );
17              
18             my $module = $modules{$^O}
19             or die "Operating system type $^O is currently unsupported";
20              
21             require "Unix/Uptime/$module.pm";
22             our @ISA = ("Unix::Uptime::$module");
23              
24             my $hires;
25              
26             sub want_hires {
27 2     2 0 5 my $class = shift;
28              
29 2         13 return $hires;
30             }
31              
32             sub import {
33 4     4   32 my $class = shift;
34 4 100       3405 if (grep {$_ eq ':hires'} @_) {
  1         19  
35 1         3 $hires = 1;
36 1         3 $module = "Unix::Uptime::$module";
37 1 50       4193 $module->can('load_hires')
38             and $module->load_hires();
39             }
40             }
41              
42             1;
43              
44             __END__