Fluentd/ConnectionManager.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran n/a Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 41 CC 1 SCAR 6.9
CC
1
Cov
0%
_default_port
2.0
_build_connection
2.0
BEGIN
2.0
CRAP 2.0
1 package Message::Passing::Fluentd::ConnectionManager;
2  
3 use Moo;
4 use Scalar::Util 'weaken';
5 use Fluent::Logger;
6 use AnyEvent;
7 use namespace::autoclean;
8  
9 with qw/
10 Message::Passing::Role::ConnectionManager
11 Message::Passing::Role::HasHostnameAndPort
12 /;
13  
14 sub _default_port { 24224 }
15  
16 sub _build_connection {
17 my $self = shift;
18 weaken($self);
19 my $client = Fluent::Logger->new(
20 host => $self->hostname || 'localhost',
21 port => $self->port || $self->_default_port,
22 retry_immediately => 1,
23 timeout => $self->timeout,
24 buffer_overflow_handler => sub {
25 $self->error->consume(shift)
26 }
27 );
28 # Delay calling set_connected till we've finished building the client
29 my $i; $i = AnyEvent->idle(cb => sub { undef $i; $self->_set_connected(1) });
30 return $client;
31 }
32  
33 1;