blib/lib/Measure/Everything/Adapter/InfluxDB/UDP.pm

filter: Statementstmt 100% 25 / 25 Branchbran n/a Conditioncond 42.8% 3 / 7 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 79.5% 35 / 44 CC 4 SCAR 8.9
CC
4
Cov
88%
init
4.6
BEGIN
1.0
BEGIN
1.0
CRAP 2.4
↑ Summary
1 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Measure::Everything::Adapter::InfluxDB::UDP;
5 # ABSTRACT: A Measure::Everything adapter to feed InfluxDB through UDP.
6 7 $Measure::Everything::Adapter::InfluxDB::UDP::VERSION = '0.01';
7  
8 7 ▶use IO::Socket::INET;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 7 ▶use base qw(Measure::Everything::Adapter::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 7 ▶use InfluxDB::LineProtocol qw(data2line);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 6 ▶sub init {
Subroutine init: called CC=4 SCAR=15.2
Pod undocumented
14 6 my $self = shift;
15 6 my %config = @_;
16 my $socket = IO::Socket::INET->new(
17 PeerAddr => $config{host} || $config{addr} || 'localhost',
18 6 ▶ PeerPort => $config{port} || 8089,
Condition42%3/7
$config{'host'} || $config{'addr'} || 'localhost'
l!l
60
$config{"host"} or $config{"addr"}
l!l&&r!l&&!r
600
$config{'port'} || 8089
l!l
60
MC/DC0%0/2
$config{'host'} || $config{'addr'} || 'localhost'
$config{"host"} $config{"addr"}
MC/DC0%0/1
$config{'port'} || 8089
$config{'port'}
Truth table33%1/3
A or B
A= $config{"host"}B= $config{"addr"}
ABresult
1X1
011
000
Truth table50%1/2
A
A= $config{'port'}
Aresult
11
00
19 Proto => 'udp',
20 ReuseAddr => 1,
21 );
22 6 $self->{socket} = $socket;
23 6 return $self;
24 }
25  
26 6 ▶sub write {
Subroutine write: called CC=1 SCAR=0.0
Pod undocumented
27 6 my $self = shift;
28 6 my $line = data2line(@_);
29 6 return $self->{socket}->send( $line );
30 }
31  
32 7 1;
33  
34 __END__
↑ Summary