Lim/RPC/Protocol/SOAP.pm

filter: Statementstmt 76.6% 167 / 218 Branchbran 44.7% 34 / 76 Conditioncond 31.1% 14 / 45 MC/DCmcdc 4.0% 1 / 25 Subroutinesub 95.6% 22 / 23 Podpod 100% 6 / 6 totaltotal 62.0% 244 / 393 CC 62 SCAR 31.3
CC
62
Cov
63%
handle
52.9
__wsdl_gen_complex_types
33.0
precall
24.7
CRAP 22.8
« Lim/Agent/Server.pm ↑ Summary Lim/RPC/TLS.pm »
1 package Lim::RPC::Protocol::SOAP;
2  
3 5 ▶use common::sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 ▶use Scalar::Util qw(blessed weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 5 ▶use HTTP::Status qw(:constants);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use HTTP::Request ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use HTTP::Response ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 5 ▶use SOAP::Lite ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 5 ▶use SOAP::Transport::HTTP ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 5 ▶use Lim ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16 5 ▶use Lim::RPC::Callback ();
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 5 ▶use base qw(Lim::RPC::Protocol);
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 5 our $VERSION = $Lim::VERSION;
33  
34 =head1 SYNOPSIS
35  
36 ...
37  
38 =head1 SUBROUTINES/METHODS
39  
40 =head2 Init
41  
42 =cut
43  
44 1 ▶sub Init {
Subroutine Init: called CC=1 SCAR=0.0
Pod documented
45 }
46  
47 =head2 Destroy
48  
49 =cut
50  
51 1 ▶sub Destroy {
Subroutine Destroy: called CC=1 SCAR=0.0
Pod documented
52 1 my ($self) = @_;
53
54 1 delete $self->{soap};
55 1 delete $self->{wsdl};
56 }
57  
58 =head2 name
59  
60 =cut
61  
62 9 ▶sub name {
Subroutine name: called CC=1 SCAR=0.0
Pod documented
63 9 'soap';
64 }
65  
66 =head2 serve
67  
68 =cut
69  
70 1 ▶sub serve {
Subroutine serve: called CC=9 SCAR=22.0
Pod documented
71 1 my ($self, $module, $module_shortname) = @_;
72 1 my ($wsdl, $calls, $tns, $soap, $soap_name, $dispatch, $obj, $obj_class);
73
74 1 $calls = $module->Calls;
75 1 $tns = $module.'::Server';
76 1 ($soap_name = $module) =~ s/:://go;
77  
78 1 $soap = SOAP::Transport::HTTP::Server->new;
79 1 $soap->serializer->ns('urn:'.$tns, 'lim1');
80 1 $soap->serializer->autotype(0);
81 1 $obj = $self->server->module_obj_by_protocol($module_shortname, $self->name);
82 1 $obj_class = ref($obj);
83 # TODO: check if $obj_class alread is a SOAP::Server::Parameters
84 1 eval "push(\@${obj_class}::ISA, 'SOAP::Server::Parameters');";
85 1 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 1 1
86 0 die $@;
87 }
88 1 $dispatch = {};
89 1 foreach my $call (keys %$calls) {
90 5 $dispatch->{'urn:'.$tns.'#'.$call} = $obj;
91 }
92 1 $soap->dispatch_with($dispatch);
93 1 $self->{soap}->{$module} = $soap;
94
95 1 $wsdl =
96 '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
97 <wsdl:definitions
98 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
99 xmlns:tns="urn:'.$tns.'"
100 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
101 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
102 name="'.$soap_name.'"
103 targetNamespace="urn:'.$tns.'">
104  
105 ';
106  
107 # Generate types
108 1 $wsdl .= ' <wsdl:types>
109 <xsd:schema targetNamespace="urn:'.$tns.'">
110 ';
111 1 foreach my $call (keys %$calls) {
112 5 my $h = $calls->{$call};
113
114 5 ▶ if (exists $h->{in}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $h->{'in'}) { } 3 2 5
115 3 $wsdl .= ' <xsd:element name="'.$call.'">
116 <xsd:complexType>
117 <xsd:choice minOccurs="0" maxOccurs="unbounded">
118 ';
119 3 $wsdl .= __wsdl_gen_complex_types($h->{in});
120 3 $wsdl .= '</xsd:choice>
121 </xsd:complexType>
122 </xsd:element>
123 ';
124 }
125 else {
126 2 $wsdl .= ' <xsd:element name="'.$call.'" />
127 ';
128 }
129
130 5 ▶ if (exists $h->{out}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $h->{'out'}) { } 5 0 5
131 5 $wsdl .= ' <xsd:element name="'.$call.'Response">
132 <xsd:complexType>
133 <xsd:choice minOccurs="0" maxOccurs="unbounded">
134 ';
135 5 $wsdl .= __wsdl_gen_complex_types($h->{out});
136 5 $wsdl .= '</xsd:choice>
137 </xsd:complexType>
138 </xsd:element>
139 ';
140 }
141 else {
142 0 $wsdl .= ' <xsd:element name="'.$call.'Response" />
143 ';
144 }
145 }
146 1 $wsdl .= ' </xsd:schema>
147 </wsdl:types>
148  
149 ';
150
151 # Generate message
152 1 foreach my $call (keys %$calls) {
153 5 $wsdl .= ' <wsdl:message name="'.$call.'">
154 <wsdl:part element="tns:'.$call.'" name="parameters" />
155 </wsdl:message>
156 ';
157 5 $wsdl .= ' <wsdl:message name="'.$call.'Response">
158 <wsdl:part element="tns:'.$call.'Response" name="parameters" />
159 </wsdl:message>
160 ';
161 }
162 1 $wsdl .= '
163 ';
164
165 # Generate portType
166 1 $wsdl .= ' <wsdl:portType name="'.$soap_name.'">
167 ';
168 1 foreach my $call (keys %$calls) {
169 5 $wsdl .= ' <wsdl:operation name="'.$call.'">
170 <wsdl:input message="tns:'.$call.'" />
171 <wsdl:output message="tns:'.$call.'Response" />
172 </wsdl:operation>
173 ';
174 }
175 1 $wsdl .= ' </wsdl:portType>
176  
177 ';
178
179 # Generate binding
180 1 $wsdl .= ' <wsdl:binding name="'.$soap_name.'SOAP" type="tns:'.$soap_name.'">
181 <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
182 ';
183 1 foreach my $call (keys %$calls) {
184 5 $wsdl .= ' <wsdl:operation name="'.$call.'">
185 <soap:operation soapAction="urn:'.$tns.'#'.$call.'" />
186 <wsdl:input>
187 <soap:body use="literal" />
188 </wsdl:input>
189 <wsdl:output>
190 <soap:body use="literal" />
191 </wsdl:output>
192 </wsdl:operation>
193 ';
194 }
195 1 $wsdl .= ' </wsdl:binding>
196  
197 ';
198  
199 # Generate service
200 1 $wsdl .= ' <wsdl:service name="'.$soap_name.'">
201 <wsdl:port binding="tns:'.$soap_name.'SOAP" name="'.$soap_name.'SOAP">
202 <soap:address location="';
203  
204 1 $wsdl = [ $wsdl, '" />
205 </wsdl:port>
206 </wsdl:service>
207  
208 </wsdl:definitions>
209 ' ];
210  
211 1 $self->{wsdl}->{$module} = $wsdl;
212  
213 1 $self;
214 }
215  
216 =head2 __wsdl_gen_complex_types
217  
218 =cut
219  
220 8 ▶sub __wsdl_gen_complex_types {
Subroutine __wsdl_gen_complex_types: called CC=17 SCAR=35.0
221 8 my @values = @_;
222 8 my $wsdl = '';
223  
224 8 ▶ while (scalar @values) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @values) 22 0 22
225 22 my $values = pop(@values);
226
227 22 ▶ if (ref($values) eq 'ARRAY' and scalar @$values == 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $values eq "ARRAY" and scalar @$values == 2) 7 15 22
Condition66%2/3
ref $values eq "ARRAY" and scalar @$values == 2
!ll&&!rl&&r
1507
MC/DC50%1/2
ref $values eq "ARRAY" and scalar @$values == 2
ref $values eq "ARRAY" scalar @$values == 2
Truth table66%2/3
A and B
A= ref $values eq "ARRAY"B= scalar @$values == 2
ABresult
0X0
100
111
228 7 my $key = $values->[0];
229 7 $values = $values->[1];
230
231 7 ▶ if (blessed $values) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($values)) { } 0 7 7
232 0 ▶ $wsdl .= '<xsd:element minOccurs="'.($values->required ? '1' : '0').'" maxOccurs="unbounded" name="'.$key.'"><xsd:complexType><xsd:choice minOccurs="0" maxOccurs="unbounded">
Branch: 1 branch
BranchTrueFalseTotal
$values->required ? : 0 0 0
233 ';
234 0 ▶ if ($values->isa('Lim::RPC::Value::Collection')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($values->isa("Lim::RPC::Value::Collection")) 0 0 0
235 0 $values = $values->children;
236 }
237 }
238 else {
239 7 $wsdl .= '<xsd:element minOccurs="0" maxOccurs="unbounded" name="'.$key.'"><xsd:complexType><xsd:choice minOccurs="0" maxOccurs="unbounded">
240 ';
241 }
242 }
243
244 22 ▶ if (ref($values) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $values eq "HASH") 15 7 22
245 15 my $nested = 0;
246
247 15 foreach my $key (keys %$values) {
248 25 ▶ if (blessed $values->{$key}) {
Branch: 2 branches
BranchTrueFalseTotal
if (builtin::blessed($values->{$key})) { } 0 25 25
elsif (ref $values->{$key} eq 'HASH') { } 7 18 25
249 0 ▶ if ($values->{$key}->isa('Lim::RPC::Value::Collection')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($values->{$key}->isa('Lim::RPC::Value::Collection')) { } 0 0 0
250 0 ▶ unless ($nested) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($nested) 0 0 0
251 0 $nested = 1;
252 0 push(@values, 1);
253 }
254 0 push(@values, [$key, $values->{$key}->children]);
255 }
256 else {
257 0 ▶ $wsdl .= '<xsd:element minOccurs="'.($values->{$key}->required ? '1' : '0').'" maxOccurs="1" name="'.$key.'" type="'.$values->{$key}->xsd_type.'" />
Branch: 1 branch
BranchTrueFalseTotal
$values->{$key}->required ? : 0 0 0
258 ';
259 }
260 }
261 elsif (ref($values->{$key}) eq 'HASH') {
262 7 ▶ unless ($nested) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($nested) 7 0 7
263 7 $nested = 1;
264 7 push(@values, 1);
265 }
266 7 push(@values, [$key, $values->{$key}]);
267 }
268 }
269
270 15 ▶ if ($nested) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nested) 7 8 15
271 7 next;
272 }
273 }
274
275 15 ▶ unless (scalar @values) {
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar @values) 8 7 15
276 8 last;
277 }
278
279 7 $wsdl .= '</xsd:choice></xsd:complexType></xsd:element>
280 ';
281 }
282
283 8 $wsdl;
284 }
285  
286 =head2 handle
287  
288 =cut
289  
290 1 ▶sub handle {
Subroutine handle: called CC=16 SCAR=39.7
Pod documented
291 1 my ($self, $cb, $request, $transport) = @_;
292
293 1 ▶ unless (blessed($request) and $request->isa('HTTP::Request')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($request) and $request->isa("HTTP::Request")) 0 1 1
Condition33%1/3
builtin::blessed($request) and $request->isa("HTTP::Request")
!ll&&!rl&&r
001
MC/DC0%0/2
builtin::blessed($request) and $request->isa("HTTP::Request")
builtin::blessed($request) $request->isa("HTTP::Request")
Truth table33%1/3
A and B
A= builtin::blessed($request)B= $request->isa("HTTP::Request")
ABresult
0X0
100
111
294 0 return;
295 }
296  
297 1 ▶ if ($request->header('SOAPAction') and $request->uri =~ /^\/([a-zA-Z]+)\s*$/o) {
Branch: 2 branches
BranchTrueFalseTotal
if ($request->header('SOAPAction') and $request->uri =~ m[^/([a-zA-Z]+)\s*$]ou) { } 1 0 1
elsif ($request->uri =~ m[^/([a-zA-Z]+)\.wsdl]ou) { } 0 0 0
Condition33%1/3
$request->header("SOAPAction") and $request->uri =~ m[^/([a-zA-Z]+)\s*$]ou
!ll&&!rl&&r
001
MC/DC0%0/2
$request->header("SOAPAction") and $request->uri =~ m[^/([a-zA-Z]+)\s*$]ou
$request->header("SOAPAction") $request->uri =~ m[^/([a-zA-Z]+)\s*$]ou
Truth table33%1/3
A and B
A= $request->header("SOAPAction")B= $request->uri =~ m[^/([a-zA-Z]+)\s*$]ou
ABresult
0X0
100
111
298 1 my ($module) = ($1);
299 1 my $response = HTTP::Response->new;
300 1 my $http_request = $request;
301 1 $response->request($request);
302 1 $response->protocol($request->protocol);
303
304 1 $module = lc($module);
305 1 my $server = $self->server;
306 1 ▶ if (defined $server and $server->have_module($module) and exists $self->{soap}->{$server->module_class($module)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $server and $server->have_module($module) and exists $self->{'soap'}{$server->module_class($module)}) { } 1 0 1
Condition33%2/6
defined $server and $server->have_module($module) and exists $self->{"soap"}{$server->module_class($module)}
!ll&&!rl&&r
001
defined $server and $server->have_module($module)
!ll&&!rl&&r
001
MC/DC0%0/3
defined $server and $server->have_module($module) and exists $self->{"soap"}{$server->module_class($module)}
defined $server $server->have_module($module) exists $self->{"soap"}{$server->module_class($module)}
Truth table25%1/4
A and B and C
A= defined $serverB= $server->have_module($module)C= exists $self->{"soap"}{$server->module_class($module)}
ABCresult
0XX0
10X0
1100
1111
307 1 my ($action, $method_uri, $method_name);
308 1 my $real_self = $self;
309 1 my $soap = $self->{soap}->{$server->module_class($module)};
310 1 weaken($self);
311 1 weaken($soap);
312  
313 1 ▶ Lim::RPC_DEBUG and $self->{logger}->debug('SOAP dispatch to module ', $server->module_class($module), ' obj ', $server->module_obj($module), ' proto obj ', $server->module_obj_by_protocol($module, $self->name));
Branch: 1 branch
BranchTrueFalseTotal
Lim::RPC_DEBUG() and $self->{"logger"}->debug("SOAP dispatch to module ", $server->module_class($module), " obj ", $server->module_obj($module), " proto obj ", $server->module_obj_by_protocol($module, $self->name)) 1 0 1
314  
315 1 ▶ $soap->on_dispatch(sub {
Subroutine __ANON__: called CC=3 SCAR=13.0
316 1 my ($request) = @_;
317
318 1 ▶ unless (defined $self and defined $soap) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self and defined $soap) 0 1 1
Condition33%1/3
defined $self and defined $soap
!ll&&!rl&&r
001
MC/DC0%0/2
defined $self and defined $soap
defined $self defined $soap
Truth table33%1/3
A and B
A= defined $selfB= defined $soap
ABresult
0X0
100
111
319 0 return;
320 }
321
322 $request->{__lim_rpc_protocol_soap_cb} = Lim::RPC::Callback->new(
323 request => $http_request,
324 1 ▶ cb => sub {
Subroutine __ANON__: called CC=6 SCAR=21.3
325 1 my ($data) = @_;
326
327 1 ▶ unless (defined $self and defined $soap) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self and defined $soap) 0 1 1
Condition33%1/3
defined $self and defined $soap
!ll&&!rl&&r
001
MC/DC0%0/2
defined $self and defined $soap
defined $self defined $soap
Truth table33%1/3
A and B
A= defined $selfB= defined $soap
ABresult
0X0
100
111
328 0 return;
329 }
330
331 1 ▶ if (blessed $data and $data->isa('Lim::Error')) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($data) and $data->isa('Lim::Error')) { } 0 1 1
Condition33%1/3
builtin::blessed($data) and $data->isa("Lim::Error")
!ll&&!rl&&r
100
MC/DC0%0/2
builtin::blessed($data) and $data->isa("Lim::Error")
builtin::blessed($data) $data->isa("Lim::Error")
Truth table33%1/3
A and B
A= builtin::blessed($data)B= $data->isa("Lim::Error")
ABresult
0X0
100
111
332 0 $soap->make_fault($data->code, $data->message);
333 }
334 else {
335 1 my $result;
336
337 1 ▶ if (defined $data) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $data) { } 1 0 1
338 1 $result = $soap->serializer
339 ->prefix('s')
340 ->uri($method_uri)
341 ->envelope(response => $method_name . 'Response', SOAP::Data->value(__soap_result('base', $data)));
342 }
343 else {
344 0 $result = $soap->serializer
345 ->prefix('s')
346 ->uri($method_uri)
347 ->envelope(response => $method_name . 'Response');
348 0 $result =~ s/ xsi:nil="true"//go;
349 }
350
351 1 $soap->make_response($SOAP::Constants::HTTP_ON_SUCCESS_CODE, $result);
352 }
353
354 1 $response = $soap->response;
355 1 $response->header(
356 'Cache-Control' => 'no-cache',
357 'Pragma' => 'no-cache'
358 );
359
360 1 $cb->cb->($response);
361 1 return;
362 },
363 0 ▶ reset_timeout => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
364 0 $cb->reset_timeout;
365 1 });
366
367 1 return;
368 1 });
369
370 1 ▶ $soap->on_action(sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
371 1 ($action, $method_uri, $method_name) = @_;
372 1 });
373  
374 1 eval {
375 1 $soap->request($request);
376 1 $soap->handle;
377 };
378 1 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 1 1
379 0 ▶ Lim::WARN and $self->{logger}->warn('SOAP action failed: ', $@);
Branch: 1 branch
BranchTrueFalseTotal
Lim::WARN() and $self->{"logger"}->warn("SOAP action failed: ", $@) 0 0 0
380 0 $response->code(HTTP_INTERNAL_SERVER_ERROR);
381 }
382 else {
383 1 ▶ if ($soap->response) {
Branch: 1 branch
BranchTrueFalseTotal
if ($soap->response) 1 0 1
384 1 $cb->cb->($soap->response);
385 }
386 1 return 1;
387 }
388 }
389 else {
390 0 return;
391 }
392  
393 0 $cb->cb->($response);
394 0 return 1;
395 }
396 elsif ($request->uri =~ /^\/([a-zA-Z]+)\.wsdl/o) {
397 0 my ($module) = ($1);
398 0 my $response = HTTP::Response->new;
399 0 $response->request($request);
400 0 $response->protocol($request->protocol);
401
402 0 $module = lc($module);
403 0 my $server = $self->server;
404 0 ▶ if (defined $server and $server->have_module($module) and exists $self->{wsdl}->{$server->module_class($module)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $server and $server->have_module($module) and exists $self->{'wsdl'}{$server->module_class($module)}) { } 0 0 0
Condition0%0/6
defined $server and $server->have_module($module) and exists $self->{"wsdl"}{$server->module_class($module)}
!ll&&!rl&&r
000
defined $server and $server->have_module($module)
!ll&&!rl&&r
000
MC/DC0%0/3
defined $server and $server->have_module($module) and exists $self->{"wsdl"}{$server->module_class($module)}
defined $server $server->have_module($module) exists $self->{"wsdl"}{$server->module_class($module)}
Truth table0%0/4
A and B and C
A= defined $serverB= $server->have_module($module)C= exists $self->{"wsdl"}{$server->module_class($module)}
ABCresult
0XX0
10X0
1100
1111
405 0 my $wsdl = $self->{wsdl}->{$server->module_class($module)};
406 0 my $uri = $transport->uri->clone;
407 0 $uri->path($module);
408
409 0 $response->content($wsdl->[0].
410 $uri->as_string.
411 $wsdl->[1]);
412 0 $response->header(
413 'Content-Type' => 'text/xml; charset=utf-8',
414 'Cache-Control' => 'no-cache',
415 'Pragma' => 'no-cache'
416 );
417 0 $response->code(HTTP_OK);
418 }
419 else {
420 0 return;
421 }
422  
423 0 $cb->cb->($response);
424 0 return 1;
425 }
426 0 return;
427 }
428  
429 =head2 __soap_result
430  
431 =cut
432  
433 1 ▶sub __soap_result {
Subroutine __soap_result: called CC=7 SCAR=27.0
434 1 my @a;
435
436 1 foreach my $k (keys %{$_[1]}) {
437 1 ▶ if (ref($_[1]->{$k}) eq 'ARRAY') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $_[1]{$k} eq 'ARRAY') { } 0 1 1
elsif (ref $_[1]{$k} eq 'HASH') { } 0 1 1
438 0 foreach my $v (@{$_[1]->{$k}}) {
439 0 ▶ if (ref($v) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $v eq 'HASH') { } 0 0 0
440 0 push(@a,
441 SOAP::Data->new->name($k)
442 ->value(Lim::RPC::__soap_result($_[0].'.'.$k, $v))
443 );
444 }
445 else {
446 0 push(@a,
447 SOAP::Data->new->name($k)
448 ->value($v)
449 );
450 }
451 }
452 }
453 elsif (ref($_[1]->{$k}) eq 'HASH') {
454 push(@a,
455 SOAP::Data->new->name($k)
456 0 ->value(Lim::RPC::__soap_result($_[0].'.'.$k, $_[1]->{$k}))
457 );
458 }
459 else {
460 push(@a,
461 SOAP::Data->new->name($k)
462 1 ->value($_[1]->{$k})
463 );
464 }
465 }
466  
467 1 ▶ if ($_[0] eq 'base') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0] eq 'base') { } 1 0 1
468 1 return @a;
469 }
470 else {
471 0 return \@a;
472 }
473 }
474  
475 =head2 precall
476  
477 =cut
478  
479 1 ▶sub precall {
Subroutine precall: called CC=10 SCAR=32.1
Pod documented
480 1 my ($self, $call, $object) = @_;
481 1 my $som = pop(@_);
482
483 1 ▶ unless (ref($call) eq '' and blessed($object) and blessed($som) and $som->isa('SOAP::SOM')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $call eq "" and builtin::blessed($object) and builtin::blessed($som) and $som->isa("SOAP::SOM")) 0 1 1
Condition33%3/9
ref $call eq "" and builtin::blessed($object) and builtin::blessed($som) and $som->isa("SOAP::SOM")
!ll&&!rl&&r
001
ref $call eq "" and builtin::blessed($object) and builtin::blessed($som)
!ll&&!rl&&r
001
ref $call eq "" and builtin::blessed($object)
!ll&&!rl&&r
001
MC/DC0%0/4
ref $call eq "" and builtin::blessed($object) and builtin::blessed($som) and $som->isa("SOAP::SOM")
ref $call eq "" builtin::blessed($object) builtin::blessed($som) $som->isa("SOAP::SOM")
Truth table20%1/5
A and B and C and D
A= ref $call eq ""B= builtin::blessed($object)C= builtin::blessed($som)D= $som->isa("SOAP::SOM")
ABCDresult
0XXX0
10XX0
110X0
11100
11111
484 0 confess __PACKAGE__, ': Invalid SOAP call';
485 }
486  
487 1 ▶ unless (exists $som->{__lim_rpc_protocol_soap_cb} and blessed($som->{__lim_rpc_protocol_soap_cb}) and $som->{__lim_rpc_protocol_soap_cb}->isa('Lim::RPC::Callback')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $som->{"__lim_rpc_protocol_soap_cb"} and builtin::blessed($som->{"__lim_rpc_protocol_soap_cb"}) and $som->{"__lim_rpc_protocol_soap_cb"}->isa("Lim::RPC::Callback")) 0 1 1
Condition33%2/6
exists $som->{"__lim_rpc_protocol_soap_cb"} and builtin::blessed($som->{"__lim_rpc_protocol_soap_cb"}) and $som->{"__lim_rpc_protocol_soap_cb"}->isa("Lim::RPC::Callback")
!ll&&!rl&&r
001
exists $som->{"__lim_rpc_protocol_soap_cb"} and builtin::blessed($som->{"__lim_rpc_protocol_soap_cb"})
!ll&&!rl&&r
001
MC/DC0%0/3
exists $som->{"__lim_rpc_protocol_soap_cb"} and builtin::blessed($som->{"__lim_rpc_protocol_soap_cb"}) and $som->{"__lim_rpc_protocol_soap_cb"}->isa("Lim::RPC::Callback")
exists $som->{"__lim_rpc_protocol_soap_cb"} builtin::blessed($som->{"__lim_rpc_protocol_soap_cb"}) $som->{"__lim_rpc_protocol_soap_cb"}->isa("Lim::RPC::Callback")
Truth table25%1/4
A and B and C
A= exists $som->{"__lim_rpc_protocol_soap_cb"}B= builtin::blessed($som->{"__lim_rpc_protocol_soap_cb"})C= $som->{"__lim_rpc_protocol_soap_cb"}->isa("Lim::RPC::Callback")
ABCresult
0XX0
10X0
1100
1111
488 0 confess __PACKAGE__, ': SOAP::SOM does not contain lim rpc callback or invalid';
489 }
490 1 my $cb = delete $som->{__lim_rpc_protocol_soap_cb};
491 1 my $valueof = $som->valueof('//'.$call.'/');
492
493 1 ▶ if ($valueof) {
Branch: 1 branch
BranchTrueFalseTotal
if ($valueof) { } 0 1 1
494 0 ▶ unless (ref($valueof) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $valueof eq "HASH") 0 0 0
495 0 confess __PACKAGE__, ': Invalid data in SOAP call';
496 }
497 }
498 else {
499 1 undef($valueof);
500 }
501  
502 1 return ($object, $cb, $valueof);
503 }
504  
505 =head1 AUTHOR
506  
507 Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >>
508  
509 =head1 BUGS
510  
511 Please report any bugs or feature requests to L<https://github.com/jelu/lim/issues>.
512  
513 =head1 SUPPORT
514  
515 You can find documentation for this module with the perldoc command.
516  
517 perldoc Lim
518  
519 You can also look for information at:
520  
521 =over 4
522  
523 =item * Lim issue tracker (report bugs here)
524  
525 L<https://github.com/jelu/lim/issues>
526  
527 =back
528  
529 =head1 ACKNOWLEDGEMENTS
530  
531 =head1 LICENSE AND COPYRIGHT
532  
533 Copyright 2012-2013 Jerry Lundström.
534  
535 This program is free software; you can redistribute it and/or modify it
536 under the terms of either: the GNU General Public License as published
537 by the Free Software Foundation; or the Artistic License.
538  
539 See http://dev.perl.org/licenses/ for more information.
540  
541  
542 =cut
543  
544 5 1; # End of Lim::RPC::Protocol::SOAP
« Lim/Agent/Server.pm ↑ Summary Lim/RPC/TLS.pm »