File Coverage

blib/lib/Time/Stopwatch.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 22 22 100.0


line stmt bran cond sub pod time code
1             package Time::Stopwatch;
2             $VERSION = '1.00';
3              
4             # POD documentation after __END__ below
5              
6 1     1   772 use strict;
  1         2  
  1         63  
7 1     1   7 use constant HIRES => eval { local $SIG{__DIE__}; require Time::HiRes };
  1         2  
  1         1  
  1         4  
  1         257324  
8              
9             sub TIESCALAR {
10 9     9   612 my $pkg = shift;
11 9 100       56 my $time = (HIRES ? Time::HiRes::time() : time()) - (@_ ? shift() : 0);
12 9         40 bless \$time, $pkg;
13             }
14              
15 119358     119358   4970747 sub FETCH { (HIRES ? Time::HiRes::time() : time()) - ${$_[0]}; }
  119358         306304  
16 59675     59675   123931 sub STORE { ${$_[0]} = (HIRES ? Time::HiRes::time() : time()) - $_[1]; }
  59675         157198  
17              
18             "That's all, folks!"
19             __END__