File Coverage

blib/lib/Sys/Load.pm
Criterion Covered Total %
statement 12 17 70.5
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 25 64.0


line stmt bran cond sub pod time code
1              
2             package Sys::Load;
3              
4 1     1   15528 use 5.006;
  1         3  
  1         40  
5 1     1   5 use strict;
  1         3  
  1         30  
6 1     1   5 use warnings;
  1         2  
  1         123  
7              
8             require Exporter;
9             require DynaLoader;
10              
11             our @ISA = qw(Exporter DynaLoader);
12              
13             our @EXPORT_OK = qw( getload uptime );
14              
15             our $VERSION = '0.2';
16              
17             bootstrap Sys::Load $VERSION;
18              
19             # Preloaded methods go here.
20              
21 1     1   5 use constant UPTIME => "/proc/uptime";
  1         2  
  1         174  
22              
23             sub uptime {
24 0 0   0 0   open(FILE, UPTIME) || return 0;
25 0           my $line = ;
26 0           my($uptime, $idle) = split /\s+/, $line;
27 0           close FILE;
28 0           return $uptime;
29             }
30              
31             1;
32              
33             __END__