Remote/Role/LogForwarder.pm

filter: Statementstmt 65.7% 23 / 35 Branchbran 31.2% 5 / 16 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 2 totaltotal 51.5% 33 / 64 CC 10 SCAR 25.0
CC
10
Cov
52%
__ANON__
21.0
exclude_forwarding
2.9
exclude_forwarding
2.9
CRAP 12.2
« Remote/Connector/UNIX.pm ↑ Summary Remote/Connector/SSH.pm »
1 package Object::Remote::Role::LogForwarder;
2  
3 18 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 18 ▶has enable_forward => ( is => 'rw', default => sub { 1 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
6 18 has _forward_destination => ( is => 'rw' );
7 #lookup table for package names that should not
8 #be forwarded across Object::Remote connections
9 18 ▶has _forward_stop => ( is => 'ro', required => 1, default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
10  
11 15856 ▶after _deliver_message => sub {
Subroutine __ANON__: called CC=8 SCAR=30.5
12 # my ($self, $level, $generator, $args, $metadata) = @_;
13 15856 my ($self, %message_info) = @_;
14 15856 my $package = $message_info{caller_package};
15 15856 my $destination = $self->_forward_destination;
16 15856 our $reentrant;
17  
18 15856 ▶ if (defined $message_info{object_remote}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $message_info{"object_remote"}) 3 15853 15856
19 3 $message_info{object_remote} = { %{$message_info{object_remote}} };
20 }
21  
22 15856 $message_info{object_remote}->{forwarded} = 1;
23  
24 15856 ▶ return unless $self->enable_forward;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->enable_forward 0 15856 15856
25 15856 ▶ return unless defined $destination;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $destination 15856 0 15856
26 0 ▶ return if $self->_forward_stop->{$package};
Branch: 1 branch
BranchTrueFalseTotal
if $self->_forward_stop->{$package} 0 0 0
27  
28 0 ▶ if (defined $reentrant) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Object::Remote::Role::LogForwarder::reentrant) 0 0 0
29 0 warn "log forwarding went reentrant. bottom: '$reentrant' top: '$package'";
30 0 return;
31 }
32  
33 0 local $reentrant = $package;
34  
35 0 eval { $destination->_deliver_message(%message_info) };
36  
37 0 ▶ if ($@ && $@ !~ /^Attempt to use Object::Remote::Proxy backed by an invalid handle/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@ and not $@ =~ /^Attempt to use Object::Remote::Proxy backed by an invalid handle/) 0 0 0
Condition0%0/3
$@ and not $@ =~ /^Attempt to use Object::Remote::Proxy backed by an invalid handle/
!ll&&!rl&&r
000
MC/DC0%0/2
$@ and not $@ =~ /^Attempt to use Object::Remote::Proxy backed by an invalid handle/
$@ not $@ =~ /^Attempt to use Object::Remote::Proxy backed by an invalid handle/
Truth table0%0/3
A and not(B)
A= $@B= not $@ =~ /^Attempt to use Object::Remote::Proxy backed by an invalid handle/
ABresult
0X0
100
111
38 0 die $@;
39 }
40 18 };
41  
42 112 ▶sub exclude_forwarding {
Subroutine exclude_forwarding: called CC=2 SCAR=10.5
Pod undocumented
43 0 ▶ my ($self, $package) = @_;
Subroutine exclude_forwarding: not called CC=2 SCAR=10.5
Pod undocumented
44 0 ▶ $package = caller unless defined $package;
Branch: 2 branches
BranchTrueFalseTotal
unless defined $package 0 0 0
unless defined $package 112 0 112
45 0 $self->_forward_stop->{$package} = 1;
46 }
47  
48 18 1;
« Remote/Connector/UNIX.pm ↑ Summary Remote/Connector/SSH.pm »