File Coverage

eg/MyTimer.pm
Criterion Covered Total %
statement 24 24 100.0
branch 1 2 50.0
condition n/a
subroutine 8 8 100.0
pod 3 3 100.0
total 36 37 97.3


line stmt bran cond sub pod time code
1             package MyTimer;
2 1     1   1334 use strict;
  1         2  
  1         28  
3 1     1   4 use warnings;
  1         1  
  1         26  
4              
5             ##
6             ## This is an example of how to subclass Devel::Timer
7             ##
8              
9 1     1   4 use strict;
  1         1  
  1         14  
10 1     1   400 use Devel::Timer;
  1         2  
  1         33  
11 1     1   14 use vars qw(@ISA);
  1         1  
  1         174  
12              
13             @ISA = ("Devel::Timer");
14              
15             sub initialize {
16 1     1 1 1 my ($self) = @_;
17              
18 1         2 my $log = "timer.log";
19 1 50       95 open(my $fh, '>>', $log) or die("Unable to open [$log] for writing.");
20 1         6 $self->{MyTimer_fh} = $fh;
21             }
22              
23             sub print {
24 7     7 1 11 my($self, $msg) = @_;
25 7         6 print {$self->{MyTimer_fh}} $msg . "\n";
  7         27  
26             }
27              
28             sub shutdown {
29 2     2 1 6 my ($self) = @_;
30 2         195 close $self->{MyTimer_fh};
31             }
32              
33             1;
34