InfluxDB/Point.pm

filter: Statementstmt 60.8% 14 / 23 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 50.0% 3 / 6 Podpod 100% 1 / 1 totaltotal 51.4% 18 / 35 CC 4 SCAR 17.6
CC
4
Cov
52%
inflate
12.0
__ANON__
6.0
__ANON__
1.1
CRAP 5.8
↑ Summary InfluxDB.pm »
1 package Mojo::InfluxDB::Point;
2 # ABSTRACT: Data point dynamic container
3 1 $Mojo::InfluxDB::Point::VERSION = '0.1';
4 1 ▶use Mojo::Base -base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use DateTime::Format::Strptime;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 has [qw/ time_zone fields /];
9 0 ▶has time => sub { die "A point without time is pointless!" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
10 0 ▶has at => sub($self) {
Subroutine __ANON__: not called CC=2 SCAR=17.9
11 0 state $strp = DateTime::Format::Strptime->new( pattern => '%FT%T%Z' );
12  
13 0 my $dt = $strp->parse_datetime( $self->time );
14 0 ▶ $dt->set_time_zone( $self->time_zone ) if $self->time_zone;
Branch: 1 branch
BranchTrueFalseTotal
if $self->time_zone 0 0 0
15 0 $dt;
16 1 };
17  
18 0 ▶sub inflate($class, $src) {
Subroutine inflate: not called CC=3 SCAR=24.8
Pod documented
19 0 ▶ my $time = delete $src->{time} || die "A point without time is pointless!";
Condition0%0/2
delete $src->{'time'} || die('A point without time is pointless!')
l!l
00
MC/DC0%0/1
delete $src->{'time'} || die('A point without time is pointless!')
delete $src->{'time'}
Truth table0%0/2
A
A= delete $src->{'time'}
Aresult
11
00
20 0 my @fields = keys %$src;
21 0 has($_) for @fields;
22 0 $class->new( time => $time, fields => \@fields, %$src );
23 }
24  
25 1 1;
26  
27 __END__
↑ Summary InfluxDB.pm »