| 1 | package IPC::Manager::Client; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 358 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 358 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 358 | our $VERSION = '0.000036'; | |||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 358 | ▶ | use Carp qw/croak/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 358 | ▶ | use Scalar::Util qw/blessed weaken/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 358 | ▶ | use Time::HiRes qw/time/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 358 | ▶ | use IPC::Manager::Util qw/pid_is_running tinysleep/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 358 | ▶ | use IPC::Manager::Message; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 358 | use Object::HashBase qw{ | |||||||||||||||||||||||||||||||||||||||||
| 16 | <id | ||||||||||||||||||||||||||||||||||||||||||
| 17 | <pid | ||||||||||||||||||||||||||||||||||||||||||
| 18 | <route | ||||||||||||||||||||||||||||||||||||||||||
| 19 | <disconnected | ||||||||||||||||||||||||||||||||||||||||||
| 20 | <serializer | ||||||||||||||||||||||||||||||||||||||||||
| 21 | +reconnect | ||||||||||||||||||||||||||||||||||||||||||
| 22 | <stats | ||||||||||||||||||||||||||||||||||||||||||
| 23 | +creator_pid | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 358 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 358 | my ($PID, @LOCAL); | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | sub local_clients { | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 159 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
local_clients: called CC=5 SCAR=16.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 159 | my ($route) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 159 | ▶ | croak "'route' is required" unless $route; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 158 | ▶ | return unless $PID; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 158 | ▶ | if ($PID != $$) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | $PID = $$; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | return @LOCAL = (); | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 158 | ▶ | return grep { $_ && $_->route eq $route } @LOCAL; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | ▶ | sub unspawn { } | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unspawn: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | ▶ | sub pre_disconnect_hook { } | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pre_disconnect_hook: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | ▶ | sub pre_suspend_hook { } | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pre_suspend_hook: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | ▶ | sub post_suspend_hook { } | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
post_suspend_hook: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | ▶ | sub post_disconnect_hook { } | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
post_disconnect_hook: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | ▶ | sub peer_left { } | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
peer_left: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 6 | ▶ | sub reconnect { shift->connect(@_, reconnect => 1) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reconnect: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 3753 | ▶ | sub pid_check { croak "Client used from wrong PID" if $_[0]->{+PID} != $$; $_[0] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pid_check: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 627 | ▶ | sub sort_messages { shift; IPC::Manager::Message::sort_messages(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sort_messages: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | ▶ | sub have_pending_messages { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
have_pending_messages: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | ▶ | sub have_ready_messages { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
have_ready_messages: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 61 | ▶ | sub have_handles_for_select { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
have_handles_for_select: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | ▶ | sub handles_for_select { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handles_for_select: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | # When a client multiplexes a dynamic set of handles (sockets accepted at | ||||||||||||||||||||||||||||||||||||||||||
| 62 | # runtime, etc.) consumers of handles_for_select cannot cache an IO::Select | ||||||||||||||||||||||||||||||||||||||||||
| 63 | # object: handles added after the cache was built would be missed. Clients | ||||||||||||||||||||||||||||||||||||||||||
| 64 | # that mutate their handle set during normal operation should override this | ||||||||||||||||||||||||||||||||||||||||||
| 65 | # to return true so consumers know to rebuild. | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 425 | ▶ | sub have_dynamic_handles_for_select { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
have_dynamic_handles_for_select: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 90 | ▶ | sub suspend_supported { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
suspend_supported: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 97 | ▶ | sub have_handles_for_peer_change { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
have_handles_for_peer_change: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | ▶ | sub reset_handles_for_peer_change { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset_handles_for_peer_change: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | ▶ | sub handles_for_peer_change { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handles_for_peer_change: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | ▶ | sub get_messages { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_messages: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | ▶ | sub peer_exists { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
peer_exists: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 1 | ▶ | sub peer_pid { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
peer_pid: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 1 | ▶ | sub peers { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
peers: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | ▶ | sub read_stats { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_stats: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 1 | ▶ | sub send_message { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_message: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 1 | ▶ | sub spawn { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
spawn: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | ▶ | sub write_stats { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_stats: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | ▶ | sub all_stats { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
all_stats: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | ▶ | sub _viable { croak "Not Implemented" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_viable: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | # Outbox API defaults. | ||||||||||||||||||||||||||||||||||||||||||
| 85 | # | ||||||||||||||||||||||||||||||||||||||||||
| 86 | # Clients backed by memory or DB stores cannot EAGAIN at the | ||||||||||||||||||||||||||||||||||||||||||
| 87 | # granularity of a single message; they get this no-op fallback so | ||||||||||||||||||||||||||||||||||||||||||
| 88 | # service code can call the outbox API uniformly. Clients backed by | ||||||||||||||||||||||||||||||||||||||||||
| 89 | # a kernel transport (FIFO, datagram socket) override these by | ||||||||||||||||||||||||||||||||||||||||||
| 90 | # consuming IPC::Manager::Role::Outbox. | ||||||||||||||||||||||||||||||||||||||||||
| 91 | sub try_send_message { | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
try_send_message: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | $self->send_message(@_); | |||||||||||||||||||||||||||||||||||||||||
| 94 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | ▶ | sub pending_sends { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pending_sends: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 299 | ▶ | sub have_pending_sends { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
have_pending_sends: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | ▶ | sub pending_sends_to { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pending_sends_to: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | ▶ | sub drain_pending { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
drain_pending: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 245 | ▶ | sub have_writable_handles { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
have_writable_handles: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 1 | ▶ | sub writable_handles { () } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
writable_handles: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | ▶ | sub send_blocking { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_blocking: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 55 | ▶ | sub set_send_blocking { return } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_send_blocking: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 1 | ▶ | sub can_send_to { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_send_to: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | sub viable { | ||||||||||||||||||||||||||||||||||||||||||
| 110 | 7 | ▶ | my $self_or_class = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
viable: called CC=5 SCAR=16.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 7 | ▶ | my $class = blessed($self_or_class) || $self_or_class; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
builtin::blessed($self_or_class) || $self_or_class
MC/DC0%0/2
builtin::blessed($self_or_class) || $self_or_class
builtin::blessed($self_or_class)
$self_or_class
Truth table33%1/3
A || B
A= builtin::blessed($self_or_class)B= $self_or_class
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 7 | local $@; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 7 | my $out; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 7 | ▶ | my $ok = eval { $out = $self_or_class->_viable ? 1 : 0; 1 }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 7 | ▶ | warn "'$class' is not viable: $@" unless $ok; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 7 | ▶ | return $out // 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$out // 0
MC/DC100%1/1
$out // 0
$out
Truth table100%2/2
A
A= $out
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | sub connect { | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 559 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connect: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | 559 | my ($id, $serializer, $route, %params) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 122 | 559 | return $class->new(%params, SERIALIZER() => $serializer, ROUTE() => $route, ID() => $id); | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | sub init { | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 650 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=11 SCAR=24.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 650 | ▶ | if (!$PID || $PID != $$) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $PID or $PID != $$
MC/DC100%2/2
not $PID or $PID != $$
not $PID
$PID != $$
Truth table100%3/3
not(A) or B
A= not $PIDB= $PID != $$
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 239 | $PID = $$; | |||||||||||||||||||||||||||||||||||||||||
| 130 | 239 | @LOCAL = (); | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 650 | push @LOCAL => $self; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 650 | weaken($LOCAL[-1]); | |||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 650 | ▶ | croak "'serializer' is a required attribute" unless $self->{+SERIALIZER}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 649 | ▶ | croak "'route' is a required attribute" unless $self->{+ROUTE}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 648 | ▶ | my $id = $self->{+ID} // croak "'id' is a required attribute"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"id"} // croak("'id' is a required attribute")
MC/DC0%0/2
$self->{"id"} // croak("'id' is a required attribute")
$self->{"id"}
croak("'id' is a required attribute")
Truth table33%1/3
A // B
A= $self->{"id"}B= croak("'id' is a required attribute")
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 647 | ▶ | croak "'id' may not begin with an underscore" if $id =~ m/^_/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 646 | ▶ | $self->{+PID} //= $$; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"pid"} //= $$
MC/DC0%0/2
$self->{"pid"} //= $$
$self->{"pid"}
$$
Truth table33%1/3
A //= B
A= $self->{"pid"}B= $$
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | # CREATOR_PID is the pid that originally constructed this | ||||||||||||||||||||||||||||||||||||||||||
| 146 | # client. It NEVER changes after init, even when init runs | ||||||||||||||||||||||||||||||||||||||||||
| 147 | # again post-fork (Object::HashBase calls init from the parent | ||||||||||||||||||||||||||||||||||||||||||
| 148 | # constructor; subclasses or post-fork resets may also run init | ||||||||||||||||||||||||||||||||||||||||||
| 149 | # later). DESTROY uses this to refuse FIFO/socket cleanup in a | ||||||||||||||||||||||||||||||||||||||||||
| 150 | # process that merely inherited the client object across fork. | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 646 | ▶ | $self->{+CREATOR_PID} //= $$; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"creator_pid"} //= $$
MC/DC0%0/2
$self->{"creator_pid"} //= $$
$self->{"creator_pid"}
$$
Truth table33%1/3
A //= B
A= $self->{"creator_pid"}B= $$
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 646 | ▶ | $self->{+STATS} = $self->read_stats if $self->{+RECONNECT}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 646 | ▶ | $self->{+STATS} //= {read => {}, sent => {}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"stats"} //= {"read", {}, "sent", {}}
MC/DC100%1/1
$self->{"stats"} //= {"read", {}, "sent", {}}
$self->{"stats"}
Truth table100%2/2
A
A= $self->{"stats"}
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | sub build_message { | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 561 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_message: called CC=5 SCAR=16.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 561 | ▶ | my $in = @_ % 2 ? shift(@_) : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 561 | ▶ | if (@_ == 2 && $_[1] ne 'content') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ == 2 and $_[1] ne "content"
MC/DC50%1/2
@_ == 2 and $_[1] ne "content"
@_ == 2
$_[1] ne "content"
Truth table66%2/3
A and B
A= @_ == 2B= $_[1] ne "content"
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 424 | @_ = (to => $_[0], content => $_[1]); | |||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 561 | ▶ | return IPC::Manager::Message->new(($in ? %$in : ()), from => $self->{+ID}, @_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | sub broadcast { | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 174 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
broadcast: called CC=6 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | 174 | ▶ | if (@_ == 1 && !(blessed($_[0]) && $_[0]->isa('IPC::Manager::Message'))) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
@_ == 1 and not builtin::blessed($_[0]) && $_[0]->isa("IPC::Manager::Message")
builtin::blessed($_[0]) && $_[0]->isa('IPC::Manager::Message')
MC/DC0%0/3
@_ == 1 and not builtin::blessed($_[0]) && $_[0]->isa("IPC::Manager::Message")
@_ == 1
builtin::blessed($_[0])
$_[0]->isa('IPC::Manager::Message')
Truth table25%1/4
A and not(B && C)
A= @_ == 1B= builtin::blessed($_[0])C= $_[0]->isa('IPC::Manager::Message')
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 174 | @_ = (content => $_[0]); | |||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 174 | my %out; | |||||||||||||||||||||||||||||||||||||||||
| 174 | 174 | for my $peer ($self->peers) { | |||||||||||||||||||||||||||||||||||||||||
| 175 | 134 | my ($ok, $err) = $self->try_message(@_, to => $peer, broadcast => 1, id => undef); | |||||||||||||||||||||||||||||||||||||||||
| 176 | 134 | ▶ | $out{$peer} = $ok ? {sent => 1} : {sent => 0, error => $err}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 174 | return \%out; | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | sub try_message { | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 152 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
try_message: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 152 | my $args = \@_; | |||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 152 | my ($ok, $err); | |||||||||||||||||||||||||||||||||||||||||
| 187 | { | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 152 | local $@; | |||||||||||||||||||||||||||||||||||||||||
| 189 | 152 | ▶ | if (eval { $self->send_message(@$args); 1 }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 144 | $ok = 1; | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 8 | $ok = 0; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 8 | ▶ | $err = $@ // "unknown error"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$@ // "unknown error"
MC/DC0%0/1
$@ // "unknown error"
$@
Truth table50%1/2
A
A= $@
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 152 | ▶ | return ($ok, $err) if wantarray; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 7 | $@ = $err; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 7 | return $ok; | |||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | sub requeue_message { | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
requeue_message: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $self->send_message(@_, to => $self->{+ID}); | |||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | sub peer_active { | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 178 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
peer_active: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 178 | my ($peer, $timeout) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 178 | ▶ | return $self->_peer_active_once($peer) unless defined $timeout; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | # timeout == 0 means "block indefinitely". Otherwise build a deadline. | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 156 | ▶ | my $deadline = $timeout > 0 ? time + $timeout : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 156 | while (1) { | |||||||||||||||||||||||||||||||||||||||||
| 219 | 457 | ▶ | return 1 if $self->_peer_active_once($peer); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | 304 | my $remaining; | |||||||||||||||||||||||||||||||||||||||||
| 222 | 304 | ▶ | if (defined $deadline) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 295 | $remaining = $deadline - time; | |||||||||||||||||||||||||||||||||||||||||
| 224 | 295 | ▶ | return 0 if $remaining <= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 301 | $self->_wait_for_peer_change($remaining); | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | sub _peer_active_once { | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 479 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_peer_active_once: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | 479 | my ($peer) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 479 | my $peer_pid = $self->peer_pid($peer); | |||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 479 | ▶ | return 0 unless $peer_pid; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 166 | ▶ | return 0 unless $self->pid_is_running($peer_pid); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 166 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | # Block (up to $remaining seconds, or indefinitely if undef) waiting for | ||||||||||||||||||||||||||||||||||||||||||
| 243 | # something that might indicate the peer set has changed. When the client | ||||||||||||||||||||||||||||||||||||||||||
| 244 | # advertises have_handles_for_peer_change we use IO::Select on those | ||||||||||||||||||||||||||||||||||||||||||
| 245 | # handles; otherwise we fall back to a short Time::HiRes sleep and re-poll. | ||||||||||||||||||||||||||||||||||||||||||
| 246 | # | ||||||||||||||||||||||||||||||||||||||||||
| 247 | # Note: IN_CREATE inotify watches (FS-based protocols) only fire for new | ||||||||||||||||||||||||||||||||||||||||||
| 248 | # peer directories, not for pidfile writes inside an existing peer dir, so | ||||||||||||||||||||||||||||||||||||||||||
| 249 | # we still clamp the IO::Select wait to a sub-second value so the caller | ||||||||||||||||||||||||||||||||||||||||||
| 250 | # continues to catch pidfile-only transitions. | ||||||||||||||||||||||||||||||||||||||||||
| 251 | sub _wait_for_peer_change { | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 301 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_wait_for_peer_change: called CC=4 SCAR=15.0
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 301 | my ($remaining) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | 301 | my $max_wait = 0.05; | |||||||||||||||||||||||||||||||||||||||||
| 256 | 301 | ▶ | $max_wait = $remaining if defined($remaining) && $remaining < $max_wait; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $remaining and $remaining < $max_wait
MC/DC100%2/2
defined $remaining and $remaining < $max_wait
defined $remaining
$remaining < $max_wait
Truth table100%3/3
A and B
A= defined $remainingB= $remaining < $max_wait
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 301 | ▶ | if ($self->have_handles_for_peer_change) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | require IO::Select; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my $s = IO::Select->new($self->handles_for_peer_change); | |||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | $s->can_read($max_wait); | |||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | $self->reset_handles_for_peer_change; | |||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | 301 | tinysleep($max_wait); | |||||||||||||||||||||||||||||||||||||||||
| 267 | 301 | return; | |||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | sub disconnect { | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 1249 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disconnect: called CC=9 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | 1249 | my ($handler) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 1249 | $self->pid_check; | |||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 1249 | ▶ | return if $self->{+DISCONNECTED}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | 526 | $self->pre_disconnect_hook; | |||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | # Wait for any messages that are still being written | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 526 | my $err; | |||||||||||||||||||||||||||||||||||||||||
| 282 | 526 | while (1) { | |||||||||||||||||||||||||||||||||||||||||
| 283 | 551 | my $pend = $self->pending_messages; | |||||||||||||||||||||||||||||||||||||||||
| 284 | 551 | my $ready = $self->ready_messages; | |||||||||||||||||||||||||||||||||||||||||
| 285 | 551 | ▶ | last unless $pend || $ready; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$pend or $ready
MC/DC100%2/2
$pend or $ready
$pend
$ready
Truth table100%3/3
A or B
A= $pendB= $ready
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 29 | ▶ | if (my @ready = $self->get_messages) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 16 | @ready = grep { !$_->is_terminate } @ready; | |||||||||||||||||||||||||||||||||||||||||
| 289 | 16 | ▶ | if (@ready) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 8 | ▶ | if ($handler) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 4 | $self->$handler(\@ready); | |||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 294 | 4 | $self->{+STATS}->{read}->{$_->{from}}-- for @ready; | |||||||||||||||||||||||||||||||||||||||||
| 295 | 4 | $err = "Messages waiting at disconnect for $self->{+ID}"; | |||||||||||||||||||||||||||||||||||||||||
| 296 | 4 | last; | |||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 13 | sleep 1; | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 526 | $self->{+DISCONNECTED} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | 526 | $self->post_disconnect_hook; | |||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 526 | $self->write_stats; | |||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 526 | ▶ | croak $err if $err; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | sub suspend { | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 5 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
suspend: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 5 | $self->pid_check; | |||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | 5 | $self->pre_suspend_hook; | |||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 5 | $self->{+DISCONNECTED} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | 5 | $self->post_suspend_hook; | |||||||||||||||||||||||||||||||||||||||||
| 323 | 5 | $self->write_stats; | |||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 550 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=6 SCAR=21.0
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | # CREATOR_PID is sticky (set once in init, never overwritten on | ||||||||||||||||||||||||||||||||||||||||||
| 329 | # post-fork resets). +PID gets refreshed in forked children, so | ||||||||||||||||||||||||||||||||||||||||||
| 330 | # using it here would let DESTROY in a child unlink the FIFO/socket | ||||||||||||||||||||||||||||||||||||||||||
| 331 | # the parent still owns. Compare creator pid instead. | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 550 | ▶ | return unless $self->{+CREATOR_PID} && $self->{+CREATOR_PID} == $$; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"creator_pid"} and $self->{"creator_pid"} == $$
MC/DC50%1/2
$self->{"creator_pid"} and $self->{"creator_pid"} == $$
$self->{"creator_pid"}
$self->{"creator_pid"} == $$
Truth table66%2/3
A and B
A= $self->{"creator_pid"}B= $self->{"creator_pid"} == $$
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 538 | local $@; | |||||||||||||||||||||||||||||||||||||||||
| 334 | 538 | ▶ | eval { $self->disconnect; 1 } or warn $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 538 | ▶ | eval { $self->write_stats; 1 } or warn $@ unless $self->{+DISCONNECTED}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$self->{'disconnected'} || (eval {
do {
$self->write_stats;
1
}
} || warn($@))
eval {
do {
$self->write_stats;
1
}
} or warn $@
MC/DC0%0/2
$self->{'disconnected'} || (eval {
do {
$self->write_stats;
1
}
} || warn($@))
$self->{'disconnected'}
eval {
do {
$self->write_stats;
1
}
}
Truth table33%1/3
A || B
A= $self->{'disconnected'}B= eval {
do {
$self->write_stats;
1
}
}
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 358 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | __END__ | ||||||||||||||||||||||||||||||||||||||||||