lib/Dancer/Timer.pm

filter: Statementstmt 100% 27 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 3 / 3 totaltotal 100% 38 / 38 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Dancer/Logger/Console.pm ↑ Summary
1 package Dancer::Timer;
2 232 our $AUTHORITY = 'cpan:SUKRIA';
3 #ABSTRACT: a timer for Dancer
4 232 $Dancer::Timer::VERSION = '1.3522';
5 232 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 232 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 232 ▶use base 'Dancer::Object';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 232 ▶use Time::HiRes 'gettimeofday', 'tv_interval';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 232 ▶use Dancer::ModuleLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 232 Dancer::Timer->attributes('start_time');
12  
13 528 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod documented
14 528 my ($self) = @_;
15 528 $self->start_time([gettimeofday()]);
16 }
17  
18 38 ▶sub tick {
Subroutine tick: called CC=1 SCAR=0.0
Pod documented
19 38 my ($self) = @_;
20 38 my $now = [gettimeofday()];
21 38 my $delay = tv_interval($self->start_time, $now);
22 38 return sprintf('%0f', $delay);
23 }
24  
25 1 ▶sub to_string {
Subroutine to_string: called CC=1 SCAR=0.0
Pod documented
26 1 my ($self) = @_;
27 1 $self->tick;
28 }
29  
30 232 1;
31  
32 __END__
« lib/Dancer/Logger/Console.pm ↑ Summary