File Coverage

blib/lib/Net/PulseMeter/Sensor/Base.pm
Criterion Covered Total %
statement 27 27 100.0
branch 2 2 100.0
condition n/a
subroutine 10 10 100.0
pod 0 5 0.0
total 39 44 88.6


line stmt bran cond sub pod time code
1             package Net::PulseMeter::Sensor::Base;
2 18     18   2136255 use strict;
  18         41  
  18         2094  
3 18     18   1302 use warnings 'all';
  18         32  
  18         2275  
4              
5 18     18   100 use base qw/Exporter/;
  18         1281  
  18         1652  
6 18     18   97 use Data::Dumper;
  18         2674  
  18         861  
7 18     18   17482 use Redis;
  18         1079217  
  18         3338  
8              
9             our $redis;
10              
11             sub new {
12 21     21 0 973 my $class = shift;
13 21         51 my $self = {};
14 21         66 bless($self, $class);
15 21         189 $self->init(@_);
16 21         67 return $self;
17             }
18              
19             sub init {
20 21     21 0 50 my ($self, $name) = @_;
21 21         190 $self->{name} = $name;
22             }
23              
24 136     136 0 2074 sub r { $redis }
25             sub redis {
26 25     25 0 19797 my ($self, $r) = @_;
27 25 100       202 $redis = $r if ($r);
28 25         408 return $redis;
29             }
30 65     65 0 1212 sub name { shift->{name} }
31              
32             1;