Lim/RPC/Protocol/SOAP.pm

filter: Statementstmt 76.5% 166 / 217 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 61.9% 243 / 392 SCAR 55.3
CC
62
Cov
63%
handle
53.8
__wsdl_gen_complex_types
33.0
precall
24.7
CRAP 251.8
« Lim/RPC/Protocol/HTTP.pm ↑ Summary Lim/RPC/Value/Collection.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 ▶sub Init {
Subroutine Init: called CC=1 SCAR=0.0
Pod documented
45 }
46  
47 =head2 Destroy
48  
49 =cut
50  
51 sub Destroy {
52 1 ▶ my ($self) = @_;
Subroutine Destroy: called CC=1 SCAR=0.0
Pod documented
53
54 1 delete $self->{soap};
55 1 delete $self->{wsdl};
56 }
57  
58 =head2 name
59  
60 =cut
61  
62 sub name {
63 8 ▶ 'soap';
Subroutine name: called CC=1 SCAR=0.0
Pod documented
64 }
65  
66 =head2 serve
67  
68 =cut
69  
70 sub serve {
71 1 ▶ my ($self, $module, $module_shortname) = @_;
Subroutine serve: called CC=9 SCAR=22.0
Pod documented
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 sub __wsdl_gen_complex_types {
221 8 ▶ my @values = @_;
Subroutine __wsdl_gen_complex_types: called CC=17 SCAR=35.0
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 sub handle {
291 1 ▶ my ($self, $cb, $request, $transport) = @_;
Subroutine handle: called CC=16 SCAR=39.8
Pod documented
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 $response->request($request);
301 1 $response->protocol($request->protocol);
302
303 1 $module = lc($module);
304 1 my $server = $self->server;
305 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
306 1 my ($action, $method_uri, $method_name);
307 1 my $real_self = $self;
308 1 my $soap = $self->{soap}->{$server->module_class($module)};
309 1 weaken($self);
310 1 weaken($soap);
311  
312 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
313  
314 $soap->on_dispatch(sub {
315 1 ▶ my ($request) = @_;
Subroutine __ANON__: called CC=3 SCAR=13.0
316
317 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
318 0 return;
319 }
320
321 $request->{__lim_rpc_protocol_soap_cb} = Lim::RPC::Callback->new(
322 cb => sub {
323 1 ▶ my ($data) = @_;
Subroutine __ANON__: called CC=6 SCAR=21.3
324
325 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
326 0 return;
327 }
328
329 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
330 0 $soap->make_fault($data->code, $data->message);
331 }
332 else {
333 1 my $result;
334
335 1 ▶ if (defined $data) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $data) { } 1 0 1
336 1 $result = $soap->serializer
337 ->prefix('s')
338 ->uri($method_uri)
339 ->envelope(response => $method_name . 'Response', SOAP::Data->value(__soap_result('base', $data)));
340 }
341 else {
342 0 $result = $soap->serializer
343 ->prefix('s')
344 ->uri($method_uri)
345 ->envelope(response => $method_name . 'Response');
346 0 $result =~ s/ xsi:nil="true"//go;
347 }
348
349 1 $soap->make_response($SOAP::Constants::HTTP_ON_SUCCESS_CODE, $result);
350 }
351
352 1 $response = $soap->response;
353 1 $response->header(
354 'Cache-Control' => 'no-cache',
355 'Pragma' => 'no-cache'
356 );
357
358 1 $cb->cb->($response);
359 1 return;
360 },
361 reset_timeout => sub {
362 0 ▶ $cb->reset_timeout;
Subroutine __ANON__: not called CC=1 SCAR=6.9
363 1 });
364
365 1 return;
366 1 });
367
368 $soap->on_action(sub {
369 1 ▶ ($action, $method_uri, $method_name) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
370 1 });
371  
372 1 eval {
373 1 $soap->request($request);
374 1 $soap->handle;
375 };
376 1 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 1 1
377 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
378 0 $response->code(HTTP_INTERNAL_SERVER_ERROR);
379 }
380 else {
381 1 ▶ if ($soap->response) {
Branch: 1 branch
BranchTrueFalseTotal
if ($soap->response) 1 0 1
382 1 $cb->cb->($soap->response);
383 }
384 1 return 1;
385 }
386 }
387 else {
388 0 return;
389 }
390  
391 0 $cb->cb->($response);
392 0 return 1;
393 }
394 elsif ($request->uri =~ /^\/([a-zA-Z]+)\.wsdl/o) {
395 0 my ($module) = ($1);
396 0 my $response = HTTP::Response->new;
397 0 $response->request($request);
398 0 $response->protocol($request->protocol);
399
400 0 $module = lc($module);
401 0 my $server = $self->server;
402 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
403 0 my $wsdl = $self->{wsdl}->{$server->module_class($module)};
404 0 my $uri = $transport->uri->clone;
405 0 $uri->path($module);
406
407 0 $response->content($wsdl->[0].
408 $uri->as_string.
409 $wsdl->[1]);
410 0 $response->header(
411 'Content-Type' => 'text/xml; charset=utf-8',
412 'Cache-Control' => 'no-cache',
413 'Pragma' => 'no-cache'
414 );
415 0 $response->code(HTTP_OK);
416 }
417 else {
418 0 return;
419 }
420  
421 0 $cb->cb->($response);
422 0 return 1;
423 }
424 0 return;
425 }
426  
427 =head2 __soap_result
428  
429 =cut
430  
431 sub __soap_result {
432 1 ▶ my @a;
Subroutine __soap_result: called CC=7 SCAR=27.0
433
434 1 foreach my $k (keys %{$_[1]}) {
435 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
436 0 foreach my $v (@{$_[1]->{$k}}) {
437 0 ▶ if (ref($v) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $v eq 'HASH') { } 0 0 0
438 0 push(@a,
439 SOAP::Data->new->name($k)
440 ->value(Lim::RPC::__soap_result($_[0].'.'.$k, $v))
441 );
442 }
443 else {
444 0 push(@a,
445 SOAP::Data->new->name($k)
446 ->value($v)
447 );
448 }
449 }
450 }
451 elsif (ref($_[1]->{$k}) eq 'HASH') {
452 push(@a,
453 SOAP::Data->new->name($k)
454 0 ->value(Lim::RPC::__soap_result($_[0].'.'.$k, $_[1]->{$k}))
455 );
456 }
457 else {
458 push(@a,
459 SOAP::Data->new->name($k)
460 1 ->value($_[1]->{$k})
461 );
462 }
463 }
464  
465 1 ▶ if ($_[0] eq 'base') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0] eq 'base') { } 1 0 1
466 1 return @a;
467 }
468 else {
469 0 return \@a;
470 }
471 }
472  
473 =head2 precall
474  
475 =cut
476  
477 sub precall {
478 1 ▶ my ($self, $call, $object) = @_;
Subroutine precall: called CC=10 SCAR=32.1
Pod documented
479 1 my $som = pop(@_);
480
481 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
482 0 confess __PACKAGE__, ': Invalid SOAP call';
483 }
484  
485 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
486 0 confess __PACKAGE__, ': SOAP::SOM does not contain lim rpc callback or invalid';
487 }
488 1 my $cb = delete $som->{__lim_rpc_protocol_soap_cb};
489 1 my $valueof = $som->valueof('//'.$call.'/');
490
491 1 ▶ if ($valueof) {
Branch: 1 branch
BranchTrueFalseTotal
if ($valueof) { } 0 1 1
492 0 ▶ unless (ref($valueof) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $valueof eq "HASH") 0 0 0
493 0 confess __PACKAGE__, ': Invalid data in SOAP call';
494 }
495 }
496 else {
497 1 undef($valueof);
498 }
499  
500 1 return ($object, $cb, $valueof);
501 }
502  
503 =head1 AUTHOR
504  
505 Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >>
506  
507 =head1 BUGS
508  
509 Please report any bugs or feature requests to L<https://github.com/jelu/lim/issues>.
510  
511 =head1 SUPPORT
512  
513 You can find documentation for this module with the perldoc command.
514  
515 perldoc Lim
516  
517 You can also look for information at:
518  
519 =over 4
520  
521 =item * Lim issue tracker (report bugs here)
522  
523 L<https://github.com/jelu/lim/issues>
524  
525 =back
526  
527 =head1 ACKNOWLEDGEMENTS
528  
529 =head1 LICENSE AND COPYRIGHT
530  
531 Copyright 2012-2013 Jerry Lundström.
532  
533 This program is free software; you can redistribute it and/or modify it
534 under the terms of either: the GNU General Public License as published
535 by the Free Software Foundation; or the Artistic License.
536  
537 See http://dev.perl.org/licenses/ for more information.
538  
539  
540 =cut
541  
542 5 1; # End of Lim::RPC::Protocol::SOAP
« Lim/RPC/Protocol/HTTP.pm ↑ Summary Lim/RPC/Value/Collection.pm »