| 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 | 15876 | ▶ | after _deliver_message => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=30.5
| |||||||||||||||||||||||||||||
| 12 | # my ($self, $level, $generator, $args, $metadata) = @_; | ||||||||||||||||||||||||||||
| 13 | 15876 | my ($self, %message_info) = @_; | |||||||||||||||||||||||||||
| 14 | 15876 | my $package = $message_info{caller_package}; | |||||||||||||||||||||||||||
| 15 | 15876 | my $destination = $self->_forward_destination; | |||||||||||||||||||||||||||
| 16 | 15876 | our $reentrant; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 15876 | ▶ | if (defined $message_info{object_remote}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 19 | 3 | $message_info{object_remote} = { %{$message_info{object_remote}} }; | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 15876 | $message_info{object_remote}->{forwarded} = 1; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 15876 | ▶ | return unless $self->enable_forward; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 15876 | ▶ | return unless defined $destination; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | return if $self->_forward_stop->{$package}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | if (defined $reentrant) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
$@ and not $@ =~ /^Attempt to use Object::Remote::Proxy backed by an invalid handle/
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/
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 45 | 0 | $self->_forward_stop->{$package} = 1; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 18 | 1; | |||||||||||||||||||||||||||