| 1 | package Lim::RPC::Server; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use common::sense; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 10 | ▶ | use Log::Log4perl (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use Scalar::Util qw(blessed weaken); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use URI (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 10 | ▶ | use URI::Split (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 10 | ▶ | use Lim (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 10 | ▶ | use Lim::RPC (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 10 | ▶ | use Lim::RPC::Value (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 10 | ▶ | use Lim::RPC::Value::Collection (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 10 | ▶ | use Lim::RPC::Protocols (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 10 | ▶ | use Lim::RPC::Transports (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 10 | ▶ | use Lim::RPC::URIMaps (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | ... | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | See L<Lim> for version. | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 10 | our $VERSION = $Lim::VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | ... | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | =head1 SUBROUTINES/METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 4 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=17 SCAR=37.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 4 | my $this = shift; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 4 | ▶ | my $class = ref($this) || $this; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $this || $this
MC/DC0%0/2
ref $this || $this
ref $this
$this
Truth table33%1/3
A || B
A= ref $thisB= $this
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 4 | my %args = ( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 48 | 4 | my $self = { | |||||||||||||||||||||||||||||||||||||||||
| 49 | logger => Log::Log4perl->get_logger($class), | ||||||||||||||||||||||||||||||||||||||||||
| 50 | protocol => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 51 | transports => [], | ||||||||||||||||||||||||||||||||||||||||||
| 52 | module => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 53 | transport_modules => {} | ||||||||||||||||||||||||||||||||||||||||||
| 54 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 4 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 56 | 4 | weaken($self->{logger}); | |||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 4 | ▶ | unless (defined $args{uri}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | confess __PACKAGE__, ': No uri specified'; | |||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | foreach my $uri (ref($args{uri}) eq 'ARRAY' ? @{$args{uri}} : $args{uri}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 4 | my $modules; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 4 | my $transport_config = {}; | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 4 | ▶ | if (ref($uri) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | if (ref($uri->{plugin}) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | $modules = { map { $_ => 1 } @{$uri->{plugin}} }; | |||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | unless (defined $uri->{uri}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if (ref($uri->{transport}) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | $transport_config = $uri->{transport}; | |||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $uri = $uri->{uri}; | |||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 4 | my ($scheme, $auth, $path, $query, $frag) = URI::Split::uri_split($uri); | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 4 | ▶ | if ($scheme =~ /^([a-z0-9_\-\.]+)(?:\+([a-z0-9_\-\.\+]+))*/o) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 4 | my ($transport_name, $protocols) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||
| 83 | 4 | my (@protocols, $transport); | |||||||||||||||||||||||||||||||||||||||||
| 84 | 4 | $uri = URI->new('', 'http'); | |||||||||||||||||||||||||||||||||||||||||
| 85 | 4 | $uri->query($query); | |||||||||||||||||||||||||||||||||||||||||
| 86 | 4 | $uri->host_port($auth); | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 4 | foreach my $protocol_name (split(/\+/o, $protocols)) { | |||||||||||||||||||||||||||||||||||||||||
| 89 | 4 | ▶ | unless (exists $self->{protocol}->{$protocol_name}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 4 | my $protocol; | |||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 4 | ▶ | unless (defined ($protocol = Lim::RPC::Protocols->instance->protocol($protocol_name, server => $self))) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | confess __PACKAGE__, ': Protocol ', $protocol_name, ' does not exists'; | |||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 4 | $self->{protocol}->{$protocol_name} = $protocol; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 4 | push(@protocols, $protocol); | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | push(@protocols, $self->{protocol}->{$protocol_name}); | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 4 | ▶ | unless (defined ($transport = Lim::RPC::Transports->instance->transport($transport_name, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | (ref($transport_config->{$transport_name}) eq 'HASH' ? (%{$transport_config->{$transport_name}}) : ()), | |||||||||||||||||||||||||||||||||||||||||
| 106 | server => $self, uri => $uri))) | ||||||||||||||||||||||||||||||||||||||||||
| 107 | { | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | confess __PACKAGE__, ': Transport ', $transport_name, ' does not exists'; | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 4 | $transport->add_protocol(@protocols); | |||||||||||||||||||||||||||||||||||||||||
| 112 | 4 | push(@{$self->{transports}}, $transport); | |||||||||||||||||||||||||||||||||||||||||
| 113 | 4 | ▶ | if ($modules) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $self->{transport_modules}->{$transport} = $modules; | |||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | confess __PACKAGE__, ': Unable to parse URI schema: ', $uri; | |||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 4 | ▶ | Lim::OBJ_DEBUG and $self->{logger}->debug('new ', __PACKAGE__, ' ', $self); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 4 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 4 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 4 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 128 | 4 | ▶ | Lim::OBJ_DEBUG and $self->{logger}->debug('destroy ', __PACKAGE__, ' ', $self); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 4 | delete $self->{transports}; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 4 | delete $self->{module}; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 4 | delete $self->{protocol}; | |||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | =head2 serve | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 4 | ▶ | sub serve { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
serve: called CC=85 SCAR=72.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | 4 | my ($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 4 | foreach my $module (@_) { | |||||||||||||||||||||||||||||||||||||||||
| 143 | 4 | my $obj; | |||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 4 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 146 | 4 | $obj = $module->Server; | |||||||||||||||||||||||||||||||||||||||||
| 147 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 4 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $module, ': ', $@); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 4 | ▶ | unless (defined $obj) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | Lim::DEBUG and $self->{logger}->debug('Can not serve ', $module, ': no object from Module->Server so may only have Client installed'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 4 | ▶ | if ($obj->isa('Lim::Component::Server')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 4 | my $name = lc($module->Name); | |||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 4 | ▶ | if (exists $self->{module}->{$name}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $name, ': plugin already served'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 4 | ▶ | unless ($module->VERSION) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $name, ': no VERSION specified in plugin'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 4 | my $calls = $module->Calls; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 4 | ▶ | unless ($calls) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | Lim::INFO and $self->{logger}->info('Not serving ', $name, ', nothing to serve'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 4 | ▶ | unless (ref($calls) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $name, ': Calls() return was invalid'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 4 | ▶ | unless (%$calls) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | Lim::INFO and $self->{logger}->info('Not serving ', $name, ', nothing to serve'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 4 | my $uri_maps = {}; | |||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 4 | foreach my $call (keys %$calls) { | |||||||||||||||||||||||||||||||||||||||||
| 187 | 20 | ▶ | unless ($obj->can($call)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $name, ': Missing specified call ', $call, ' function'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | undef($calls); | |||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 20 | my $create_call = 0; | |||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 20 | foreach my $protocol_name (keys %{$self->{protocol}}) { | |||||||||||||||||||||||||||||||||||||||||
| 196 | 20 | my $base = 'Lim::RPC::ProtocolCall::'.$protocol_name.'::'.ref($obj); | |||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 20 | ▶ | if ($base->isa('UNIVERSAL') and $base->can($call)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$base->isa("UNIVERSAL") and $base->can($call)
MC/DC0%0/2
$base->isa("UNIVERSAL") and $base->can($call)
$base->isa("UNIVERSAL")
$base->can($call)
Truth table33%1/3
A and B
A= $base->isa("UNIVERSAL")B= $base->can($call)
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 20 | $create_call = 1; | |||||||||||||||||||||||||||||||||||||||||
| 202 | 20 | last; | |||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 20 | ▶ | if ($create_call) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 20 | my $call_def = $calls->{$call}; | |||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 20 | ▶ | unless (ref($call_def) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $name, ': call ', $call, ' has invalid definition'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | undef($calls); | |||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 20 | ▶ | if (exists $call_def->{uri_map}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 12 | ▶ | unless (ref($call_def->{uri_map}) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $name, ': call ', $call, ' has invalid uri_map parameter definition'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | undef($calls); | |||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | 12 | my $uri_map = Lim::RPC::URIMaps->new; | |||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 12 | foreach my $map (@{$call_def->{uri_map}}) { | |||||||||||||||||||||||||||||||||||||||||
| 224 | 20 | ▶ | if (defined (my $redirect_call = $uri_map->add($map))) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | 20 | ▶ | if ($redirect_call) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 8 | ▶ | unless (exists $calls->{$redirect_call}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $name, ': call ', $call, ' has invalid uri_map: redirected to non-existing call ', $redirect_call); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | undef($calls); | |||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $name, ': call ', $call, ' has invalid uri_map: ', $@); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | undef($calls); | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 12 | ▶ | unless (defined $calls) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | 12 | $uri_maps->{$call} = $uri_map; | |||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 20 | ▶ | if (exists $call_def->{in}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 12 | ▶ | unless (ref($call_def->{in}) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $name, ': call ', $call, ' has invalid in parameter definition'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | undef($calls); | |||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 12 | my @keys = keys %{$call_def->{in}}; | |||||||||||||||||||||||||||||||||||||||||
| 254 | 12 | ▶ | unless (scalar @keys) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $name, ': call ', $call, ' has invalid in parameter definition'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | undef($calls); | |||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 12 | my @values = ($call_def->{in}); | |||||||||||||||||||||||||||||||||||||||||
| 261 | 12 | ▶ | while (defined $calls and (my $value = shift(@values))) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $calls and my $value = shift @values
MC/DC50%1/2
defined $calls and my $value = shift @values
defined $calls
my $value = shift @values
Truth table66%2/3
A and B
A= defined $callsB= my $value = shift @values
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 24 | foreach my $key (keys %$value) { | |||||||||||||||||||||||||||||||||||||||||
| 263 | 24 | ▶ | if (ref($value->{$key}) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 12 | ▶ | if (exists $value->{$key}->{''}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $collection = Lim::RPC::Value::Collection->new($value->{$key}->{''}); | |||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | delete $value->{$key}->{''}; | |||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $value->{$key} = $collection->set_children($value->{$key}); | |||||||||||||||||||||||||||||||||||||||||
| 269 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | unless ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | push(@values, $value->{$key}->children); | |||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Unable to create Lim::RPC::Value::Collection: ', $@); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 12 | push(@values, $value->{$key}); | |||||||||||||||||||||||||||||||||||||||||
| 278 | 12 | next; | |||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||
| 281 | elsif (blessed $value->{$key}) { | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | if ($value->{$key}->isa('Lim::RPC::Value')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | if ($value->{$key}->isa('Lim::RPC::Value::Collection')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | push(@values, $value->{$key}->children); | |||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 291 | 12 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 292 | 12 | $value->{$key} = Lim::RPC::Value->new($value->{$key}); | |||||||||||||||||||||||||||||||||||||||||
| 293 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 294 | 12 | ▶ | unless ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | 12 | next; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Unable to create Lim::RPC::Value: ', $@); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not server ', $name, ': call ', $call, ' has invalid in parameter definition'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | undef($calls); | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 12 | ▶ | unless (defined $calls) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 20 | ▶ | if (exists $call_def->{out}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 20 | ▶ | unless (ref($call_def->{out}) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $name, ': call ', $call, ' has invalid out parameter definition'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | undef($calls); | |||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 20 | my @keys = keys %{$call_def->{out}}; | |||||||||||||||||||||||||||||||||||||||||
| 318 | 20 | ▶ | unless (scalar @keys) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not serve ', $name, ': call ', $call, ' has invalid out parameter definition'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | undef($calls); | |||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 20 | my @values = ($call_def->{out}); | |||||||||||||||||||||||||||||||||||||||||
| 325 | 20 | ▶ | while (defined $calls and (my $value = shift(@values))) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $calls and my $value = shift @values
MC/DC50%1/2
defined $calls and my $value = shift @values
defined $calls
my $value = shift @values
Truth table66%2/3
A and B
A= defined $callsB= my $value = shift @values
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 36 | foreach my $key (keys %$value) { | |||||||||||||||||||||||||||||||||||||||||
| 327 | 76 | ▶ | if (ref($value->{$key}) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | 16 | ▶ | if (exists $value->{$key}->{''}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my $collection = Lim::RPC::Value::Collection->new($value->{$key}->{''}); | |||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | delete $value->{$key}->{''}; | |||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | $value->{$key} = $collection->set_children($value->{$key}); | |||||||||||||||||||||||||||||||||||||||||
| 333 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | unless ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | push(@values, $value->{$key}->children); | |||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Unable to create Lim::RPC::Value::Collection: ', $@); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 341 | 16 | push(@values, $value->{$key}); | |||||||||||||||||||||||||||||||||||||||||
| 342 | 16 | next; | |||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | elsif (blessed $value->{$key}) { | ||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | if ($value->{$key}->isa('Lim::RPC::Value')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | if ($value->{$key}->isa('Lim::RPC::Value::Collection')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | push(@values, $value->{$key}->children); | |||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 354 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 355 | 60 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 356 | 60 | $value->{$key} = Lim::RPC::Value->new($value->{$key}); | |||||||||||||||||||||||||||||||||||||||||
| 357 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 358 | 60 | ▶ | unless ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 60 | next; | |||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Unable to create Lim::RPC::Value: ', $@); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | Lim::WARN and $self->{logger}->warn('Can not server ', $name, ': call ', $call, ' has invalid out parameter definition'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | undef($calls); | |||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 20 | ▶ | unless (defined $calls) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 20 | my $logger = $self->{logger}; | |||||||||||||||||||||||||||||||||||||||||
| 375 | 20 | weaken($logger); | |||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | 20 | foreach my $protocol_name (keys %{$self->{protocol}}) { | |||||||||||||||||||||||||||||||||||||||||
| 378 | 20 | my $base = 'Lim::RPC::ProtocolCall::'.$protocol_name.'::'.ref($obj); | |||||||||||||||||||||||||||||||||||||||||
| 379 | 20 | my $protocol_call = $base.'::'.$call; | |||||||||||||||||||||||||||||||||||||||||
| 380 | 20 | my $protocol = $self->{protocol}->{$protocol_name}; | |||||||||||||||||||||||||||||||||||||||||
| 381 | 20 | weaken($protocol); | |||||||||||||||||||||||||||||||||||||||||
| 382 | 20 | my $weak_obj = $obj; | |||||||||||||||||||||||||||||||||||||||||
| 383 | 20 | weaken($weak_obj); | |||||||||||||||||||||||||||||||||||||||||
| 384 | 20 | weaken($call_def); | |||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | 20 | ▶ | if ($base->isa('UNIVERSAL') and $base->can($call)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$base->isa("UNIVERSAL") and $base->can($call)
MC/DC0%0/2
$base->isa("UNIVERSAL") and $base->can($call)
$base->isa("UNIVERSAL")
$base->can($call)
Truth table33%1/3
A and B
A= $base->isa("UNIVERSAL")B= $base->can($call)
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | 10 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 391 | 4 | ▶ | *$protocol_call = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=25 SCAR=54.7
| |||||||||||||||||||||||||||||||||||||||||||
| 392 | 4 | ▶ | unless (defined $protocol and defined $weak_obj and defined $call_def) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $protocol and defined $weak_obj and defined $call_def
defined $protocol and defined $weak_obj
MC/DC0%0/3
defined $protocol and defined $weak_obj and defined $call_def
defined $protocol
defined $weak_obj
defined $call_def
Truth table25%1/4
A and B and C
A= defined $protocolB= defined $weak_objC= defined $call_def
| |||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||
| 395 | 4 | my ($self, $cb, $q, @args); | |||||||||||||||||||||||||||||||||||||||||
| 396 | 4 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 397 | 4 | ($self, $cb, $q, @args) = $protocol->precall($call, @_); | |||||||||||||||||||||||||||||||||||||||||
| 398 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 399 | 4 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | Lim::WARN and defined $logger and $logger->warn($weak_obj, '->', $call, '() precall failed: ', $@); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Lim::WARN() and defined $logger
MC/DC0%0/2
Lim::WARN() and defined $logger
Lim::WARN()
defined $logger
Truth table0%0/3
A and B
A= Lim::WARN()B= defined $logger
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | $weak_obj->Error($cb); | |||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 4 | ▶ | Lim::RPC_DEBUG and defined $logger and $logger->debug('Call to ', $weak_obj, ' ', $call); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
Lim::RPC_DEBUG() and defined $logger
MC/DC0%0/2
Lim::RPC_DEBUG() and defined $logger
Lim::RPC_DEBUG()
defined $logger
Truth table33%1/3
A and B
A= Lim::RPC_DEBUG()B= defined $logger
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 4 | ▶ | if (!defined $q) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | 4 | $q = {}; | |||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||
| 410 | 4 | ▶ | if (ref($q) ne 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | Lim::WARN and defined $logger and $logger->warn($weak_obj, '->', $call, '() called without data as hash'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Lim::WARN() and defined $logger
MC/DC0%0/2
Lim::WARN() and defined $logger
Lim::WARN()
defined $logger
Truth table0%0/3
A and B
A= Lim::WARN()B= defined $logger
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $weak_obj->Error($cb); | |||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | 4 | ▶ | if (exists $call_def->{in}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | Lim::RPC::V($q, $call_def->{in}); | |||||||||||||||||||||||||||||||||||||||||
| 419 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | Lim::WARN and defined $logger and $logger->warn($weak_obj, '->', $call, '() data validation failed: ', $@); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Lim::WARN() and defined $logger
MC/DC0%0/2
Lim::WARN() and defined $logger
Lim::WARN()
defined $logger
Truth table0%0/3
A and B
A= Lim::WARN()B= defined $logger
| |||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | Lim::DEBUG and defined $logger and eval { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Lim::DEBUG() and defined $logger
MC/DC0%0/2
Lim::DEBUG() and defined $logger
Lim::DEBUG()
defined $logger
Truth table0%0/3
A and B
A= Lim::DEBUG()B= defined $logger
| |||||||||||||||||||||||||||||||||||||||||||
| 423 | 10 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $logger->debug(Dumper($q)); | |||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | $logger->debug(Dumper($call_def->{in})); | |||||||||||||||||||||||||||||||||||||||||
| 426 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | $weak_obj->Error($cb); | |||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 431 | elsif (%$q) { | ||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | Lim::WARN and defined $logger and $logger->warn($weak_obj, '->', $call, '() have data but no definition'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Lim::WARN() and defined $logger
MC/DC0%0/2
Lim::WARN() and defined $logger
Lim::WARN()
defined $logger
Truth table0%0/3
A and B
A= Lim::WARN()B= defined $logger
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | $weak_obj->Error($cb); | |||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | 4 | $cb->set_call_def($call_def); | |||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | 4 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 439 | 4 | $weak_obj->$call($cb, $q, @args); | |||||||||||||||||||||||||||||||||||||||||
| 440 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 441 | 4 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | Lim::WARN and defined $logger and $logger->warn($weak_obj, '->', $call, '() failed: ', $@); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Lim::WARN() and defined $logger
MC/DC0%0/2
Lim::WARN() and defined $logger
Lim::WARN()
defined $logger
Truth table0%0/3
A and B
A= Lim::WARN()B= defined $logger
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | $weak_obj->Error($cb); | |||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||
| 445 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||
| 446 | 20 | }; | |||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||
| 450 | 4 | ▶ | unless ($calls) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||
| 454 | 4 | ▶ | Lim::DEBUG and $self->{logger}->debug('serving ', $name); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | 4 | $self->{module}->{$name} = { | |||||||||||||||||||||||||||||||||||||||||
| 457 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 458 | module => $module, | ||||||||||||||||||||||||||||||||||||||||||
| 459 | obj => $obj, | ||||||||||||||||||||||||||||||||||||||||||
| 460 | calls => $calls, | ||||||||||||||||||||||||||||||||||||||||||
| 461 | uri_maps => $uri_maps | ||||||||||||||||||||||||||||||||||||||||||
| 462 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | 4 | foreach my $protocol (values %{$self->{protocol}}) { | |||||||||||||||||||||||||||||||||||||||||
| 465 | 4 | ▶ | Lim::DEBUG and $self->{logger}->debug('serving ', $name, ' to protocol ', $protocol->name); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 466 | 4 | $protocol->serve($module, $name); | |||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||
| 468 | 4 | foreach my $transport (@{$self->{transports}}) { | |||||||||||||||||||||||||||||||||||||||||
| 469 | 4 | ▶ | if (exists $self->{transport_modules}->{$transport} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $self->{"transport_modules"}{$transport} and not exists $self->{"transport_modules"}{$transport}{$module->Name}
MC/DC0%0/2
exists $self->{"transport_modules"}{$transport} and not exists $self->{"transport_modules"}{$transport}{$module->Name}
exists $self->{"transport_modules"}{$transport}
not exists $self->{"transport_modules"}{$transport}{$module->Name}
Truth table33%1/3
A and not(B)
A= exists $self->{"transport_modules"}{$transport}B= not exists $self->{"transport_modules"}{$transport}{$module->Name}
| |||||||||||||||||||||||||||||||||||||||||||
| 470 | and !exists $self->{transport_modules}->{$transport}->{$module->Name}) | ||||||||||||||||||||||||||||||||||||||||||
| 471 | { | ||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 474 | 4 | ▶ | Lim::DEBUG and $self->{logger}->debug('serving ', $name, ' to transport ', $transport->name, ' at ', $transport->uri); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 475 | 4 | $transport->serve($module, $name); | |||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | 4 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | =head2 have_module | ||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||
| 485 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||
| 487 | 4 | ▶ | sub have_module { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
have_module: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 488 | 4 | my ($self, $module) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | 4 | ▶ | unless (exists $self->{module}->{$module}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | =head2 have_module_call | ||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||
| 499 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | 2 | ▶ | sub have_module_call { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
have_module_call: called CC=3 SCAR=12.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 502 | 2 | my ($self, $module, $call) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||
| 504 | 2 | ▶ | unless (exists $self->{module}->{$module}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||
| 508 | 2 | ▶ | unless (exists $self->{module}->{$module}->{calls}->{$call}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | =head2 module_obj | ||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||
| 519 | 2 | ▶ | sub module_obj { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module_obj: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 520 | 2 | my ($self, $module) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||
| 522 | 2 | ▶ | unless (exists $self->{module}->{$module}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | 2 | return $self->{module}->{$module}->{obj}; | |||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||
| 529 | =head2 module_class | ||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||
| 531 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | 6 | ▶ | sub module_class { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module_class: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 534 | 6 | my ($self, $module) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||
| 536 | 6 | ▶ | unless (exists $self->{module}->{$module}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||
| 540 | 6 | return $self->{module}->{$module}->{module}; | |||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | =head2 module_obj_by_protocol | ||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||
| 545 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | 6 | ▶ | sub module_obj_by_protocol { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module_obj_by_protocol: called CC=3 SCAR=12.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 548 | 6 | my ($self, $module, $protocol) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | 6 | ▶ | unless (exists $self->{module}->{$module}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | 6 | ▶ | unless (exists $self->{protocol}->{$protocol}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | 6 | bless {}, 'Lim::RPC::ProtocolCall::'.$protocol.'::'.$self->{module}->{$module}->{module}.'::Server'; | |||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||
| 561 | =head2 process_module_call_uri_map | ||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | sub process_module_call_uri_map { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process_module_call_uri_map: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | my ($self, $module, $call, $uri, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | ▶ | unless (exists $self->{module}->{$module}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | unless (ref($data) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | ▶ | unless (exists $self->{module}->{$module}->{uri_maps}->{$call}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | return $self->{module}->{$module}->{uri_maps}->{$call}->process($uri, $data); | |||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||
| 583 | =head2 transports | ||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||
| 585 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||
| 587 | 4 | ▶ | sub transports { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
transports: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 588 | 4 | @{$_[0]->{transports}}; | |||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||
| 591 | =head2 close | ||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||
| 593 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | sub close { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | my ($self, $cb) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | ▶ | unless (ref($cb) eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | confess '$cb is not CODE'; | |||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | my $cv = AnyEvent->condvar; | |||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | $cv->begin(sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | $cb->(); | |||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | $cv = undef; | |||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | foreach my $transport (@{$self->{transports}}) { | |||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | $cv->begin; | |||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | ▶ | Lim::DEBUG and $self->{logger}->debug('Closing transport ', $transport->name); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | ▶ | $transport->close(sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | $cv->end; | |||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | $cv->end; | |||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||
| 620 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >> | ||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||
| 624 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||
| 626 | Please report any bugs or feature requests to L<https://github.com/jelu/lim/issues>. | ||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||
| 628 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||
| 630 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||
| 632 | perldoc Lim | ||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||
| 634 | You can also look for information at: | ||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | =item * Lim issue tracker (report bugs here) | ||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||
| 640 | L<https://github.com/jelu/lim/issues> | ||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||
| 642 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||
| 644 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||
| 646 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||
| 648 | Copyright 2012-2013 Jerry Lundström. | ||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||
| 650 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||
| 651 | under the terms of either: the GNU General Public License as published | ||||||||||||||||||||||||||||||||||||||||||
| 652 | by the Free Software Foundation; or the Artistic License. | ||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||
| 654 | See http://dev.perl.org/licenses/ for more information. | ||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||
| 657 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||
| 659 | 10 | 1; # End of Lim::RPC::Server | |||||||||||||||||||||||||||||||||||||||||