lib/SOAP/Lite.pm

filter: Statementstmt 81.7% 1581 / 1933 Branchbran 62.5% 686 / 1096 Conditioncond 49.8% 317 / 636 MC/DCmcdc 22.5% 82 / 364 Subroutinesub 86.1% 299 / 347 Podpod 70.0% 7 / 10 totaltotal 67.7% 2972 / 4386 CC 846 SCAR 34.8
CC
846
Cov
71%
__ANON__
370.8
decode_value
122.2
call
118.1
CRAP 32.4
« lib/SOAP/Lite/Packager.pm ↑ Summary lib/SOAP/Transport/TCP.pm »
1 # ======================================================================
2 #
3 # Copyright (C) 2000-2005 Paul Kulchenko (paulclinger@yahoo.com)
4 # SOAP::Lite is free software; you can redistribute it
5 # and/or modify it under the same terms as Perl itself.
6 #
7 # ======================================================================
8  
9 # Formatting hint:
10 # Target is the source code format laid out in Perl Best Practices (4 spaces
11 # indent, opening brace on condition line, no cuddled else).
12 #
13 # October 2007, Martin Kutter
14  
15 package SOAP::Lite;
16  
17 43 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 43 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 43 our $VERSION = '1.14';
21  
22 package SOAP::XMLSchemaApacheSOAP::Deserializer;
23  
24 sub as_map {
25 0 ▶ my $self = shift;
Subroutine as_map: not called CC=2 SCAR=17.9
26 return {
27 map {
28 0 my $hash = ($self->decode_object($_))[1];
29 ($hash->{key} => $hash->{value})
30 0 ▶ } @{$_[3] || []}
Branch: 1 branch
BranchTrueFalseTotal
$_[3] or [] 0 0 0
31 };
32 }
33 43 sub as_Map; *as_Map = \&as_map;
34  
35 # Thank to Kenneth Draper for this contribution
36 sub as_vector {
37 3 ▶ my $self = shift;
Subroutine as_vector: called CC=2 SCAR=7.0
38 3 ▶ return [ map { scalar(($self->decode_object($_))[1]) } @{$_[3] || []} ];
Branch: 1 branch
BranchTrueFalseTotal
$_[3] or [] 0 3 3
39 }
40 43 sub as_Vector; *as_Vector = \&as_vector;
41  
42 # ----------------------------------------------------------------------
43  
44 package SOAP::XMLSchema::Serializer;
45  
46 43 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
47  
48 sub xmlschemaclass {
49 388 ▶ my $self = shift;
Subroutine xmlschemaclass: called CC=2 SCAR=6.9
50 388 ▶ return $ISA[0] unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 290 98 388
51 98 @ISA = (shift);
52 98 return $self;
53 }
54  
55 # ----------------------------------------------------------------------
56  
57 package SOAP::XMLSchema1999::Serializer;
58  
59 43 ▶use vars qw(@EXPORT $AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
60  
61 sub AUTOLOAD {
62 63 ▶ local($1,$2);
Subroutine AUTOLOAD: called CC=4 SCAR=13.9
63 63 my($package, $method) = $AUTOLOAD =~ m/(?:(.+)::)([^:]+)$/;
64 63 ▶ return if $method eq 'DESTROY';
Branch: 1 branch
BranchTrueFalseTotal
if $method eq "DESTROY" 1 62 63
65 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
66  
67 62 my $export_var = $package . '::EXPORT';
68 62 my @export = @$export_var;
69  
70 # Removed in 0.69 - this is a total hack. For some reason this is failing
71 # despite not being a fatal error condition.
72 # die "Type '$method' can't be found in a schema class '$package'\n"
73 # unless $method =~ s/^as_// && grep {$_ eq $method} @{$export_var};
74  
75 # This was added in its place - it is still a hack, but it performs the
76 # necessary substitution. It just does not die.
77 62 ▶ if ($method =~ s/^as_// && grep {$_ eq $method} @{$export_var}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($method =~ s/^as_// and grep {$_ eq $method;} @{$export_var;}) { } 60 2 62
Condition66%2/3
$method =~ s/^as_// and grep {$_ eq $method;} @{$export_var;}
!ll&&!rl&&r
2060
MC/DC50%1/2
$method =~ s/^as_// and grep {$_ eq $method;} @{$export_var;}
$method =~ s/^as_// grep {$_ eq $method;} @{$export_var;}
Truth table66%2/3
A and B
A= $method =~ s/^as_//B= grep {$_ eq $method;} @{$export_var;}
ABresult
0X0
100
111
78 # print STDERR "method is now '$method'\n";
79 } else {
80 2 return;
81 }
82  
83 60 $method =~ s/_/-/; # fix ur-type
84  
85 *$AUTOLOAD = sub {
86 94 ▶ my $self = shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
87 94 my($value, $name, $type, $attr) = @_;
88 94 return [$name, {'xsi:type' => "xsd:$method", %$attr}, $value];
89 60 };
90 60 goto &$AUTOLOAD;
91 }
92  
93 BEGIN {
94 43 ▶ @EXPORT = qw(ur_type
Subroutine BEGIN: called CC=2 SCAR=6.9
95 float double decimal timeDuration recurringDuration uriReference
96 integer nonPositiveInteger negativeInteger long int short byte
97 nonNegativeInteger unsignedLong unsignedInt unsignedShort unsignedByte
98 positiveInteger timeInstant time timePeriod date month year century
99 recurringDate recurringDay language
100 base64 hex string boolean
101 );
102 # TODO: replace by symbol table operations...
103 # predeclare subs, so ->can check will be positive
104 43 foreach (@EXPORT) { eval "sub as_$_" }
105 }
106  
107 43 ▶sub nilValue { 'null' }
Subroutine nilValue: called CC=1 SCAR=0.0
108  
109 1 ▶sub anyTypeValue { 'ur-type' }
Subroutine anyTypeValue: called CC=1 SCAR=0.0
110  
111 sub as_base64 {
112 2 ▶ my ($self, $value, $name, $type, $attr) = @_;
Subroutine as_base64: called CC=4 SCAR=17.9
113  
114 # Fixes #30271 for 5.8 and above.
115 # Won't fix for 5.6 and below - perl can't handle unicode before
116 # 5.8, and applying pack() to everything is just a slowdown.
117 2 ▶ if ($SOAP::Constants::HAS_ENCODE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($SOAP::Constants::HAS_ENCODE) 2 0 2
118 2 ▶ if (Encode::is_utf8($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Encode::is_utf8($value)) 0 2 2
119 0 ▶ if (Encode->can('_utf8_off')) { # the quick way, but it may change in future Perl versions.
Branch: 1 branch
BranchTrueFalseTotal
if ('Encode'->can('_utf8_off')) { } 0 0 0
120 0 Encode::_utf8_off($value);
121 }
122 else {
123 0 $value = pack('C*',unpack('C*',$value)); # the slow but safe way,
124 # but this fallback works always.
125 }
126 }
127 }
128  
129 2 require MIME::Base64;
130 return [
131 2 $name,
132 {
133 'xsi:type' => SOAP::Utils::qualify($self->encprefix => 'base64'),
134 %$attr
135 },
136 MIME::Base64::encode_base64($value,'')
137 ];
138 }
139  
140 sub as_hex {
141 1 ▶ my ($self, $value, $name, $type, $attr) = @_;
Subroutine as_hex: called CC=1 SCAR=0.0
142 return [
143 $name,
144 {
145 'xsi:type' => 'xsd:hex', %$attr
146 },
147 join '', map {
148 1 uc sprintf "%02x", ord
149 } split '', $value
150 ];
151 }
152  
153 sub as_long {
154 4 ▶ my($self, $value, $name, $type, $attr) = @_;
Subroutine as_long: called CC=1 SCAR=0.0
155 return [
156 4 $name,
157 {'xsi:type' => 'xsd:long', %$attr},
158 $value
159 ];
160 }
161  
162 sub as_dateTime {
163 1 ▶ my ($self, $value, $name, $type, $attr) = @_;
Subroutine as_dateTime: called CC=1 SCAR=0.0
164 1 return [$name, {'xsi:type' => 'xsd:dateTime', %$attr}, $value];
165 }
166  
167 sub as_string {
168 20 ▶ my ($self, $value, $name, $type, $attr) = @_;
Subroutine as_string: called CC=2 SCAR=6.9
169 20 ▶ die "String value expected instead of @{[ref $value]} reference\n"
Branch: 1 branch
BranchTrueFalseTotal
if ref $value 1 19 20
170 if ref $value;
171 return [
172 19 $name,
173 {'xsi:type' => 'xsd:string', %$attr},
174 SOAP::Utils::encode_data($value)
175 ];
176 }
177  
178 sub as_anyURI {
179 8 ▶ my($self, $value, $name, $type, $attr) = @_;
Subroutine as_anyURI: called CC=2 SCAR=6.9
180 8 ▶ die "String value expected instead of @{[ref $value]} reference\n" if ref $value;
Branch: 1 branch
BranchTrueFalseTotal
if ref $value 1 7 8
181 return [
182 7 $name,
183 {'xsi:type' => 'xsd:anyURI', %$attr},
184 SOAP::Utils::encode_data($value)
185 ];
186 }
187  
188 2 ▶sub as_undef { $_[1] ? '1' : '0' }
Subroutine as_undef: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 1 1 2
189  
190 sub as_boolean {
191 2 ▶ my $self = shift;
Subroutine as_boolean: called CC=3 SCAR=11.0
192 2 my($value, $name, $type, $attr) = @_;
193 # fix [ 1.05279 ] Boolean serialization error
194 return [
195 2 ▶ $name,
Branch: 1 branch
BranchTrueFalseTotal
$value && $value ne 'false' ? : 1 1 2
Condition66%2/3
$value and $value ne "false"
!ll&&!rl&&r
101
MC/DC50%1/2
$value and $value ne "false"
$value $value ne "false"
Truth table66%2/3
A and B
A= $valueB= $value ne "false"
ABresult
0X0
100
111
196 {'xsi:type' => 'xsd:boolean', %$attr},
197 ( $value && $value ne 'false' ) ? 'true' : 'false'
198 ];
199 }
200  
201 sub as_float {
202 2 ▶ my($self, $value, $name, $type, $attr) = @_;
Subroutine as_float: called CC=1 SCAR=0.0
203 return [
204 2 $name,
205 {'xsi:type' => 'xsd:float', %$attr},
206 $value
207 ];
208 }
209  
210 # ----------------------------------------------------------------------
211  
212 package SOAP::XMLSchema2001::Serializer;
213  
214 43 ▶use vars qw(@EXPORT);
Subroutine BEGIN: called CC=1 SCAR=0.0
215  
216 # no more warnings about "used only once"
217 43 *AUTOLOAD if 0;
218  
219 43 *AUTOLOAD = \&SOAP::XMLSchema1999::Serializer::AUTOLOAD;
220  
221 BEGIN {
222 43 ▶ @EXPORT = qw(anyType anySimpleType float double decimal dateTime
Subroutine BEGIN: called CC=2 SCAR=6.9
223 timePeriod gMonth gYearMonth gYear century
224 gMonthDay gDay duration recurringDuration anyURI
225 language integer nonPositiveInteger negativeInteger
226 long int short byte nonNegativeInteger unsignedLong
227 unsignedInt unsignedShort unsignedByte positiveInteger
228 date time string hex base64 boolean
229 QName
230 );
231 # Add QName to @EXPORT
232 # predeclare subs, so ->can check will be positive
233 43 foreach (@EXPORT) { eval "sub as_$_" }
234 }
235  
236 73 ▶sub nilValue { 'nil' }
Subroutine nilValue: called CC=1 SCAR=0.0
237  
238 2 ▶sub anyTypeValue { 'anyType' }
Subroutine anyTypeValue: called CC=1 SCAR=0.0
239  
240 43 sub as_long; *as_long = \&SOAP::XMLSchema1999::Serializer::as_long;
241 43 sub as_float; *as_float = \&SOAP::XMLSchema1999::Serializer::as_float;
242 43 sub as_string; *as_string = \&SOAP::XMLSchema1999::Serializer::as_string;
243 43 sub as_anyURI; *as_anyURI = \&SOAP::XMLSchema1999::Serializer::as_anyURI;
244  
245 # TODO - QNames still don't work for 2001 schema!
246 43 sub as_QName; *as_QName = \&SOAP::XMLSchema1999::Serializer::as_string;
247 43 sub as_hex; *as_hex = \&as_hexBinary;
248 43 sub as_base64; *as_base64 = \&as_base64Binary;
249 43 sub as_timeInstant; *as_timeInstant = \&as_dateTime;
250  
251 # only 0 and 1 allowed - that's easy...
252 sub as_undef {
253 30 ▶ $_[1]
Subroutine as_undef: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 30 0 30
254 ? 'true'
255 : 'false'
256 }
257  
258 sub as_hexBinary {
259 2 ▶ my ($self, $value, $name, $type, $attr) = @_;
Subroutine as_hexBinary: called CC=1 SCAR=0.0
260 return [
261 $name,
262 {'xsi:type' => 'xsd:hexBinary', %$attr},
263 join '', map {
264 2 uc sprintf "%02x", ord
265 } split '', $value
266 ];
267 }
268  
269 sub as_base64Binary {
270 3 ▶ my ($self, $value, $name, $type, $attr) = @_;
Subroutine as_base64Binary: called CC=4 SCAR=17.9
271  
272 # Fixes #30271 for 5.8 and above.
273 # Won't fix for 5.6 and below - perl can't handle unicode before
274 # 5.8, and applying pack() to everything is just a slowdown.
275 3 ▶ if (eval "require Encode; 1") {
Branch: 1 branch
BranchTrueFalseTotal
if (eval "require Encode; 1") 3 0 3
276 3 ▶ if (Encode::is_utf8($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Encode::is_utf8($value)) 0 3 3
277 0 ▶ if (Encode->can('_utf8_off')) { # the quick way, but it may change in future Perl versions.
Branch: 1 branch
BranchTrueFalseTotal
if ('Encode'->can('_utf8_off')) { } 0 0 0
278 0 Encode::_utf8_off($value);
279 }
280 else {
281 0 $value = pack('C*',unpack('C*',$value)); # the slow but safe way,
282 # but this fallback works always.
283 }
284 }
285 }
286  
287 3 require MIME::Base64;
288 return [
289 3 $name,
290 {
291 'xsi:type' => 'xsd:base64Binary', %$attr
292 },
293 MIME::Base64::encode_base64($value,'')
294 ];
295 }
296  
297 sub as_boolean {
298 2 ▶ my ($self, $value, $name, $type, $attr) = @_;
Subroutine as_boolean: called CC=3 SCAR=11.1
299 # fix [ 1.05279 ] Boolean serialization error
300 return [
301 2 ▶ $name,
Branch: 1 branch
BranchTrueFalseTotal
$value && $value ne 'false' ? : 1 1 2
Condition66%2/3
$value and $value ne "false"
!ll&&!rl&&r
011
MC/DC50%1/2
$value and $value ne "false"
$value $value ne "false"
Truth table66%2/3
A and B
A= $valueB= $value ne "false"
ABresult
0X0
100
111
302 {
303 'xsi:type' => 'xsd:boolean', %$attr
304 },
305 ( $value && ($value ne 'false') )
306 ? 'true'
307 : 'false'
308 ];
309 }
310  
311  
312 # ======================================================================
313  
314 package SOAP::Utils;
315  
316 sub qualify {
317 546 ▶ $_[1]
Subroutine qualify: called CC=5 SCAR=18.9
Branch: 3 branches
BranchTrueFalseTotal
$_[1] ? : 542 4 546
$_[1] =~ /:/ ? : 0 542 542
defined $_[1] ? : 0 4 4
Condition33%1/3
$_[0] || ()
l!l&&r!l&&!r
54200
MC/DC0%0/2
$_[0] || ()
$_[0] ()
Truth table33%1/3
A || B
A= $_[0]B= ()
ABresult
1X1
011
000
318 ? $_[1] =~ /:/
319 ? $_[1]
320 : join(':', $_[0] || (), $_[1])
321 : defined $_[1]
322 ? $_[0]
323 : ''
324 }
325  
326 sub overqualify (&$) {
327 0 ▶ for ($_[1]) {
Subroutine overqualify: not called CC=2 SCAR=17.9
328 0 &{$_[0]};
329 0 s/^:|:$//g
330 }
331 }
332  
333 sub disqualify {
334 363 ▶ (my $qname = shift) =~ s/^($SOAP::Constants::NSMASK?)://;
Subroutine disqualify: called CC=1 SCAR=0.0
335 363 return $qname;
336 }
337  
338 sub splitqname {
339 539 ▶ local($1,$2);
Subroutine splitqname: called CC=1 SCAR=0.0
340 539 $_[0] =~ /^(?:([^:]+):)?(.+)$/;
341 539 return ($1,$2)
342 }
343  
344 sub longname {
345 954 ▶ defined $_[0]
Subroutine longname: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 624 330 954
346 ? sprintf('{%s}%s', $_[0], $_[1])
347 : $_[1]
348 }
349  
350 sub splitlongname {
351 876 ▶ local($1,$2);
Subroutine splitlongname: called CC=1 SCAR=0.0
352 876 $_[0] =~ /^(?:\{(.*)\})?(.+)$/;
353 876 return ($1,$2)
354 }
355  
356 # Q: why only '&' and '<' are encoded, but not '>'?
357 # A: because it is not required according to XML spec.
358 #
359 # [http://www.w3.org/TR/REC-xml#syntax]
360 # The ampersand character (&) and the left angle bracket (<) may appear in
361 # their literal form only when used as markup delimiters, or within a comment,
362 # a processing instruction, or a CDATA section. If they are needed elsewhere,
363 # they must be escaped using either numeric character references or the
364 # strings "&amp;" and "&lt;" respectively. The right angle bracket (>) may be
365 # represented using the string "&gt;", and must, for compatibility, be
366 # escaped using "&gt;" or a character reference when it appears in the
367 # string "]]>" in content, when that string is not marking the end of a
368 # CDATA section.
369  
370 43 my %encode_attribute = ('&' => '&amp;', '>' => '&gt;', '<' => '&lt;', '"' => '&quot;');
371 468 ▶sub encode_attribute { (my $e = $_[0]) =~ s/([&<>\"])/$encode_attribute{$1}/g; $e }
Subroutine encode_attribute: called CC=1 SCAR=0.0
372  
373 43 my %encode_data = ('&' => '&amp;', '>' => '&gt;', '<' => '&lt;', "\xd" => '&#xd;');
374 sub encode_data {
375 55 ▶ my $e = $_[0];
Subroutine encode_data: called CC=2 SCAR=6.9
376 55 ▶ if ($e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e) 35 20 55
377 35 $e =~ s/([&<>\015])/$encode_data{$1}/g;
378 35 $e =~ s/\]\]>/\]\]&gt;/g;
379 }
380 $e
381 55 }
382  
383 # methods for internal tree (SOAP::Deserializer, SOAP::SOM and SOAP::Serializer)
384  
385 69 ▶sub o_qname { $_[0]->[0] }
Subroutine o_qname: called CC=1 SCAR=0.0
386 0 ▶sub o_attr { $_[0]->[1] }
Subroutine o_attr: not called CC=1 SCAR=6.9
387 658 ▶sub o_child { ref $_[0]->[2] ? $_[0]->[2] : undef }
Subroutine o_child: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0][2] ? : 536 122 658
388 0 ▶sub o_chars { ref $_[0]->[2] ? undef : $_[0]->[2] }
Subroutine o_chars: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0][2] ? : 0 0 0
389 # $_[0]->[3] is not used. Serializer stores object ID there
390 166 ▶sub o_value { $_[0]->[4] }
Subroutine o_value: called CC=1 SCAR=0.0
391 1064 ▶sub o_lname { $_[0]->[5] }
Subroutine o_lname: called CC=1 SCAR=0.0
392 1563 ▶sub o_lattr { $_[0]->[6] }
Subroutine o_lattr: called CC=1 SCAR=0.0
393  
394 sub format_datetime {
395 0 ▶ my ($s,$m,$h,$D,$M,$Y) = (@_)[0,1,2,3,4,5];
Subroutine format_datetime: not called CC=1 SCAR=6.9
396 0 my $time = sprintf("%04d-%02d-%02dT%02d:%02d:%02d",($Y+1900),($M+1),$D,$h,$m,$s);
397 0 return $time;
398 }
399  
400 # make bytelength that calculates length in bytes regardless of utf/byte settings
401 # either we can do 'use bytes' or length will count bytes already
402 BEGIN {
403 sub bytelength;
404 *bytelength = eval('use bytes; 1') # 5.6.0 and later?
405 43 ▶ ? sub { use bytes; length(@_ ? $_[0] : $_) }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=2 SCAR=7.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 16 0 16
406 43 ▶ : sub { length(@_ ? $_[0] : $_) };
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine __ANON__: not called CC=2 SCAR=8.5
Branch: 2 branches
BranchTrueFalseTotal
eval 'use bytes; 1' ? : 43 0 43
@_ ? : 0 0 0
407 }
408  
409 # ======================================================================
410  
411 package SOAP::Cloneable;
412  
413 sub clone {
414 24 ▶ my $self = shift;
Subroutine clone: called CC=7 SCAR=20.5
415  
416 24 ▶ return unless ref $self && UNIVERSAL::isa($self => __PACKAGE__);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self and UNIVERSAL::isa($self, __PACKAGE__) 0 24 24
Condition33%1/3
ref $self and UNIVERSAL::isa($self, __PACKAGE__)
!ll&&!rl&&r
0024
MC/DC0%0/2
ref $self and UNIVERSAL::isa($self, __PACKAGE__)
ref $self UNIVERSAL::isa($self, __PACKAGE__)
Truth table33%1/3
A and B
A= ref $selfB= UNIVERSAL::isa($self, __PACKAGE__)
ABresult
0X0
100
111
417  
418 24 ▶ my $clone = bless {} => ref($self) || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
2400
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
419 24 for (keys %$self) {
420 211 my $value = $self->{$_};
421 211 ▶ $clone->{$_} = ref $value && UNIVERSAL::isa($value => __PACKAGE__) ? $value->clone : $value;
Branch: 1 branch
BranchTrueFalseTotal
ref $value && UNIVERSAL::isa($value, __PACKAGE__) ? : 18 193 211
Condition100%3/3
ref $value and UNIVERSAL::isa($value, __PACKAGE__)
!ll&&!rl&&r
7911418
MC/DC100%2/2
ref $value and UNIVERSAL::isa($value, __PACKAGE__)
ref $value UNIVERSAL::isa($value, __PACKAGE__)
Truth table100%3/3
A and B
A= ref $valueB= UNIVERSAL::isa($value, __PACKAGE__)
ABresult
0X0
100
111
422 }
423 24 return $clone;
424 }
425  
426 # ======================================================================
427  
428 package SOAP::Transport;
429  
430 43 ▶use vars qw($AUTOLOAD @ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
431 43 @ISA = qw(SOAP::Cloneable);
432  
433 43 ▶use Class::Inspector;
Subroutine BEGIN: called CC=1 SCAR=0.0
434  
435  
436 49 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
437  
438 sub new {
439 49 ▶ my $self = shift;
Subroutine new: called CC=3 SCAR=11.8
440 49 ▶ return $self if ref $self;
Branch: 1 branch
BranchTrueFalseTotal
if ref $self 0 49 49
441 49 ▶ my $class = ref($self) || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
0490
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
442  
443 49 SOAP::Trace::objects('()');
444 49 return bless {} => $class;
445 }
446  
447 sub proxy {
448 105 ▶ my $self = shift;
Subroutine proxy: called CC=8 SCAR=21.1
449 105 ▶ $self = $self->new() if not ref $self;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 0 105 105
450  
451 105 my $class = ref $self;
452  
453 105 ▶ return $self->{_proxy} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 88 17 105
454  
455 17 ▶ $_[0] =~ /^(\w+):/ or die "proxy: transport protocol not specified\n";
Branch: 1 branch
BranchTrueFalseTotal
$_[0] =~ /^(\w+):/ or die "proxy: transport protocol not specified\n" 0 17 17
456 17 my $protocol = uc "$1"; # untainted now
457  
458 # HTTPS is handled by HTTP class
459 17 $protocol =~s/^HTTPS$/HTTP/;
460  
461 17 (my $protocol_class = "${class}::$protocol") =~ s/-/_/g;
462  
463 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
464 17 ▶ unless (Class::Inspector->loaded("$protocol_class\::Client")
Branch: 1 branch
BranchTrueFalseTotal
unless ("Class::Inspector"->loaded("${protocol_class}::Client") and UNIVERSAL::can("${protocol_class}::Client", "new")) 15 2 17
Condition66%2/3
"Class::Inspector"->loaded("${protocol_class}::Client") and UNIVERSAL::can("${protocol_class}::Client", "new")
!ll&&!rl&&r
1502
MC/DC50%1/2
"Class::Inspector"->loaded("${protocol_class}::Client") and UNIVERSAL::can("${protocol_class}::Client", "new")
"Class::Inspector"->loaded("${protocol_class}::Client") UNIVERSAL::can("${protocol_class}::Client", "new")
Truth table66%2/3
A and B
A= "Class::Inspector"->loaded("${protocol_class}::Client")B= UNIVERSAL::can("${protocol_class}::Client", "new")
ABresult
0X0
100
111
465 && UNIVERSAL::can("$protocol_class\::Client" => 'new')
466 ) {
467 15 eval "require $protocol_class";
468 15 ▶ die "Unsupported protocol '$protocol'\n"
Branch: 1 branch
BranchTrueFalseTotal
if $@ =~ m[^Can\'t locate SOAP/Transport/] 0 15 15
469 if $@ =~ m!^Can\'t locate SOAP/Transport/!;
470 15 ▶ die if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 15 15
471 }
472  
473 17 $protocol_class .= "::Client";
474 17 return $self->{_proxy} = $protocol_class->new(endpoint => shift, @_);
475 }
476  
477 sub AUTOLOAD {
478 55 ▶ my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2);
Subroutine AUTOLOAD: called CC=2 SCAR=7.0
479 55 ▶ return if $method eq 'DESTROY';
Branch: 1 branch
BranchTrueFalseTotal
if $method eq "DESTROY" 0 55 55
480  
481 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
482 55 ▶ *$AUTOLOAD = sub { shift->proxy->$method(@_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
483 55 goto &$AUTOLOAD;
484 }
485  
486 # ======================================================================
487  
488 package SOAP::Fault;
489  
490 43 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
491  
492 43 ▶use overload fallback => 1, '""' => "stringify";
Subroutine BEGIN: called CC=1 SCAR=0.0
493  
494 0 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: not called CC=1 SCAR=6.9
495  
496 sub new {
497 0 ▶ my $self = shift;
Subroutine new: not called CC=6 SCAR=34.1
498  
499 0 ▶ unless (ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $self) 0 0 0
500 0 my $class = $self;
501 0 $self = bless {} => $class;
502 0 SOAP::Trace::objects('()');
503 }
504  
505 0 ▶ Carp::carp "Odd (wrong?) number of parameters in new()"
Branch: 1 branch
BranchTrueFalseTotal
if $^W and @_ & 1 0 0 0
Condition0%0/3
$^W and @_ & 1
!ll&&!rl&&r
000
MC/DC0%0/2
$^W and @_ & 1
$^W @_ & 1
Truth table0%0/3
A and B
A= $^WB= @_ & 1
ABresult
0X0
100
111
506 if $^W && (@_ & 1);
507  
508 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
509 0 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
510 0 my $method = shift;
511 0 ▶ $self->$method(shift)
Branch: 1 branch
BranchTrueFalseTotal
if $self->can($method) 0 0 0
512 if $self->can($method)
513 }
514  
515 0 return $self;
516 }
517  
518 sub stringify {
519 0 ▶ my $self = shift;
Subroutine stringify: not called CC=1 SCAR=6.9
520 0 return join ': ', $self->faultcode, $self->faultstring;
521 }
522  
523 sub BEGIN {
524 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
525 43 ▶ for my $method (qw(faultcode faultstring faultactor faultdetail)) {
Subroutine BEGIN: called CC=2 SCAR=12.0
526 172 my $field = '_' . $method;
527 *$method = sub {
528 0 ▶ my $self = UNIVERSAL::isa($_[0] => __PACKAGE__)
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($_[0], __PACKAGE__) ? : 0 0 0
529 ? shift->new
530 : __PACKAGE__->new;
531 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
532 0 $self->{$field} = shift;
533 0 return $self
534 }
535 0 return $self->{$field};
536 }
537 172 }
538 43 *detail = \&faultdetail;
539 }
540  
541 # ======================================================================
542  
543 package SOAP::Data;
544  
545 43 ▶use vars qw(@ISA @EXPORT_OK);
Subroutine BEGIN: called CC=1 SCAR=0.0
546 43 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
547 43 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
548 43 ▶use SOAP::Lite::Deserializer::XMLSchemaSOAP1_2;
Subroutine BEGIN: called CC=1 SCAR=0.0
549  
550 43 @ISA = qw(Exporter);
551 43 @EXPORT_OK = qw(name type attr value uri);
552  
553 683 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
554  
555 sub new {
556 1058 ▶ my $self = shift;
Subroutine new: called CC=6 SCAR=18.2
557  
558 1058 ▶ unless (ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $self) 683 375 1058
559 683 my $class = $self;
560 683 $self = bless {_attr => {}, _value => [], _signature => []} => $class;
561 683 SOAP::Trace::objects('()');
562 }
563 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
564 1058 ▶ Carp::carp "Odd (wrong?) number of parameters in new()" if $^W && (@_ & 1);
Branch: 1 branch
BranchTrueFalseTotal
if $^W and @_ & 1 0 1058 1058
Condition33%1/3
$^W and @_ & 1
!ll&&!rl&&r
105800
MC/DC0%0/2
$^W and @_ & 1
$^W @_ & 1
Truth table33%1/3
A and B
A= $^WB= @_ & 1
ABresult
0X0
100
111
565 1058 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 281 1058 1339
566 281 my $method = shift;
567 281 ▶ $self->$method(shift) if $self->can($method)
Branch: 1 branch
BranchTrueFalseTotal
if $self->can($method) 281 0 281
568 }
569  
570 1058 return $self;
571 }
572  
573 sub name {
574 1807 ▶ my $self = ref $_[0] ? shift : UNIVERSAL::isa($_[0] => __PACKAGE__) ? shift->new : __PACKAGE__->new;
Subroutine name: called CC=8 SCAR=20.8
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] ? : 1348 459 1807
UNIVERSAL::isa($_[0], __PACKAGE__) ? : 459 0 459
575 1807 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 715 1092 1807
576 715 my $name = shift;
577 715 my ($uri, $prefix); # predeclare, because can't declare in assign
578 715 ▶ if ($name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name) 600 115 715
579 600 ($uri, $name) = SOAP::Utils::splitlongname($name);
580 600 ▶ unless (defined $uri) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $uri) { } 92 508 600
581 508 ($prefix, $name) = SOAP::Utils::splitqname($name);
582 508 ▶ $self->prefix($prefix) if defined $prefix;
Branch: 1 branch
BranchTrueFalseTotal
if defined $prefix 154 354 508
583 } else {
584 92 $self->uri($uri);
585 }
586 }
587 715 $self->{_name} = $name;
588  
589 715 ▶ $self->value(@_) if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 203 512 715
590 715 return $self;
591 }
592 1092 return $self->{_name};
593 }
594  
595 sub attr {
596 1007 ▶ my $self = ref $_[0]
Subroutine attr: called CC=5 SCAR=16.2
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] ? : 1006 1 1007
UNIVERSAL::isa($_[0], __PACKAGE__) ? : 1 0 1
597 ? shift
598 : UNIVERSAL::isa($_[0] => __PACKAGE__)
599 ? shift->new()
600 : __PACKAGE__->new();
601 1007 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 411 596 1007
602 411 $self->{_attr} = shift;
603 411 ▶ return $self->value(@_) if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 411 411
604 411 return $self
605 }
606 596 return $self->{_attr};
607 }
608  
609 sub type {
610 1063 ▶ my $self = ref $_[0]
Subroutine type: called CC=7 SCAR=19.8
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] ? : 1057 6 1063
UNIVERSAL::isa($_[0], __PACKAGE__) ? : 6 0 6
611 ? shift
612 : UNIVERSAL::isa($_[0] => __PACKAGE__)
613 ? shift->new()
614 : __PACKAGE__->new();
615 1063 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 39 1024 1063
616 39 $self->{_type} = shift;
617 39 ▶ $self->value(@_) if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 5 34 39
618 39 return $self;
619 }
620 1024 ▶ if (!defined $self->{_type} && (my @types = grep {/^\{$SOAP::Constants::NS_XSI_ALL}type$/o} keys %{$self->{_attr}})) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $self->{"_type"} and my(@types) = grep({/^\{$SOAP::Constants::NS_XSI_ALL}type$/o;} keys %{$$self{"_attr"};})) 0 1024 1024
Condition66%2/3
not defined $self->{"_type"} and my(@types) = grep({/^\{$SOAP::Constants::NS_XSI_ALL}type$/o;} keys %{$$self{"_attr"};})
!ll&&!rl&&r
779470
MC/DC0%0/2
not defined $self->{"_type"} and my(@types) = grep({/^\{$SOAP::Constants::NS_XSI_ALL}type$/o;} keys %{$$self{"_attr"};})
not defined $self->{"_type"} my(@types) = grep({/^\{$SOAP::Constants::NS_XSI_ALL}type$/o;} keys %{$$self{"_attr"};})
Truth table66%2/3
not(A) and B
A= not defined $self->{"_type"}B= my(@types) = grep({/^\{$SOAP::Constants::NS_XSI_ALL}type$/o;} keys %{$$self{"_attr"};})
ABresult
0X0
100
111
621 0 $self->{_type} = (SOAP::Utils::splitlongname(delete $self->{_attr}->{shift(@types)}))[1];
622 }
623 1024 return $self->{_type};
624 }
625  
626 BEGIN {
627 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
628 43 ▶ for my $method (qw(root mustUnderstand)) {
Subroutine BEGIN: called CC=3 SCAR=12.0
629 86 my $field = '_' . $method;
630 *$method = sub {
631 2 ▶ my $attr = $method eq 'root'
Subroutine __ANON__: called CC=8 SCAR=27.1
Branch: 1 branch
BranchTrueFalseTotal
$method eq 'root' ? : 1 1 2
632 ? "{$SOAP::Constants::NS_ENC}$method"
633 : "{$SOAP::Constants::NS_ENV}$method";
634 2 ▶ my $self = UNIVERSAL::isa($_[0] => __PACKAGE__)
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($_[0], __PACKAGE__) ? : 2 0 2
635 ? shift->new
636 : __PACKAGE__->new;
637 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2 0 2
638 2 ▶ $self->{_attr}->{$attr} = $self->{$field} = shift() ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
shift() ? : 2 0 2
639 2 ▶ $self->value(@_) if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
640 2 return $self;
641 }
642 $self->{$field} = SOAP::Lite::Deserializer::XMLSchemaSOAP1_2->as_boolean($self->{_attr}->{$attr})
643 0 ▶ if !defined $self->{$field} && defined $self->{_attr}->{$attr};
Branch: 1 branch
BranchTrueFalseTotal
if not defined $self->{$field} and defined $self->{"_attr"}{$attr} 0 0 0
Condition0%0/3
not defined $self->{$field} and defined $self->{"_attr"}{$attr}
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $self->{$field} and defined $self->{"_attr"}{$attr}
not defined $self->{$field} defined $self->{"_attr"}{$attr}
Truth table0%0/3
not(A) and B
A= not defined $self->{$field}B= defined $self->{"_attr"}{$attr}
ABresult
0X0
100
111
644 0 return $self->{$field};
645 }
646 86 }
647  
648 43 for my $method (qw(actor encodingStyle)) {
649 86 my $field = '_' . $method;
650 *$method = sub {
651 8 ▶ my $attr = "{$SOAP::Constants::NS_ENV}$method";
Subroutine __ANON__: called CC=6 SCAR=19.0
652 8 ▶ my $self = UNIVERSAL::isa($_[0] => __PACKAGE__)
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($_[0], __PACKAGE__) ? : 8 0 8
653 ? shift->new()
654 : __PACKAGE__->new();
655 8 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 4 4 8
656 4 $self->{_attr}->{$attr} = $self->{$field} = shift;
657 4 ▶ $self->value(@_) if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 4 4
658 4 return $self;
659 }
660 $self->{$field} = $self->{_attr}->{$attr}
661 4 ▶ if !defined $self->{$field} && defined $self->{_attr}->{$attr};
Branch: 1 branch
BranchTrueFalseTotal
if not defined $self->{$field} and defined $self->{"_attr"}{$attr} 0 4 4
Condition33%1/3
not defined $self->{$field} and defined $self->{"_attr"}{$attr}
!ll&&!rl&&r
400
MC/DC0%0/2
not defined $self->{$field} and defined $self->{"_attr"}{$attr}
not defined $self->{$field} defined $self->{"_attr"}{$attr}
Truth table33%1/3
not(A) and B
A= not defined $self->{$field}B= defined $self->{"_attr"}{$attr}
ABresult
0X0
100
111
662 4 return $self->{$field};
663 }
664 86 }
665 }
666  
667 sub prefix {
668 572 ▶ my $self = ref $_[0]
Subroutine prefix: called CC=5 SCAR=16.6
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] ? : 571 1 572
UNIVERSAL::isa($_[0], __PACKAGE__) ? : 1 0 1
669 ? shift
670 : UNIVERSAL::isa($_[0] => __PACKAGE__)
671 ? shift->new()
672 : __PACKAGE__->new();
673 572 ▶ return $self->{_prefix} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 344 228 572
674 228 $self->{_prefix} = shift;
675 228 ▶ if (scalar @_) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_) 0 228 228
676 0 return $self->value(@_);
677 }
678 228 return $self;
679 }
680  
681 sub uri {
682 440 ▶ my $self = ref $_[0]
Subroutine uri: called CC=8 SCAR=22.1
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] ? : 438 2 440
UNIVERSAL::isa($_[0], __PACKAGE__) ? : 2 0 2
683 ? shift
684 : UNIVERSAL::isa($_[0] => __PACKAGE__)
685 ? shift->new()
686 : __PACKAGE__->new();
687 440 ▶ return $self->{_uri} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 345 95 440
688 95 my $uri = $self->{_uri} = shift;
689 95 ▶ warn "Usage of '::' in URI ($uri) deprecated. Use '/' instead\n"
Branch: 1 branch
BranchTrueFalseTotal
if defined $uri and $^W and $uri =~ /::/ 0 95 95
Condition33%2/6
defined $uri and $^W and $uri =~ /::/
!ll&&!rl&&r
9500
defined $uri and $^W
!ll&&!rl&&r
0950
MC/DC0%0/3
defined $uri and $^W and $uri =~ /::/
defined $uri $^W $uri =~ /::/
Truth table25%1/4
A and B and C
A= defined $uriB= $^WC= $uri =~ /::/
ABCresult
0XX0
10X0
1100
1111
690 if defined $uri && $^W && $uri =~ /::/;
691 95 ▶ if (scalar @_) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_) 1 94 95
692 1 return $self->value(@_);
693 }
694 94 return $self;
695 }
696  
697 sub set_value {
698 668 ▶ my $self = ref $_[0]
Subroutine set_value: called CC=3 SCAR=11.1
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] ? : 621 47 668
UNIVERSAL::isa($_[0], __PACKAGE__) ? : 47 0 47
699 ? shift
700 : UNIVERSAL::isa($_[0] => __PACKAGE__)
701 ? shift->new()
702 : __PACKAGE__->new();
703 668 $self->{_value} = [@_];
704 668 return $self;
705 }
706  
707 sub value {
708 1061 ▶ my $self = ref $_[0] ? shift
Subroutine value: called CC=5 SCAR=16.1
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] ? : 972 89 1061
UNIVERSAL::isa($_[0], __PACKAGE__) ? : 89 0 89
709 : UNIVERSAL::isa($_[0] => __PACKAGE__)
710 ? shift->new()
711 : __PACKAGE__->new;
712 1061 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 320 741 1061
713 320 return $self->set_value(@_);
714 }
715 else {
716 return wantarray
717 506 ? @{$self->{_value}}
718 741 ▶ : $self->{_value}->[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 506 235 741
719 }
720 }
721  
722 sub signature {
723 370 ▶ my $self = UNIVERSAL::isa($_[0] => __PACKAGE__)
Subroutine signature: called CC=3 SCAR=11.1
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($_[0], __PACKAGE__) ? : 370 0 370
724 ? shift->new()
725 : __PACKAGE__->new();
726 (@_)
727 ? ($self->{_signature} = shift, return $self)
728 370 ▶ : (return $self->{_signature});
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 339 31 370
729 }
730  
731 # ======================================================================
732  
733 package SOAP::Header;
734  
735 43 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
736 43 @ISA = qw(SOAP::Data);
737  
738 # ======================================================================
739  
740 package SOAP::Serializer;
741 43 ▶use SOAP::Lite::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
742 43 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
743 43 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
744  
745 43 @ISA = qw(SOAP::Cloneable SOAP::XMLSchema::Serializer);
746  
747 BEGIN {
748 # namespaces and anonymous data structures
749 43 ▶ my $ns = 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
750 43 my $name = 0;
751 43 my $prefix = 'c-';
752 16 ▶ sub gen_ns { 'namesp' . ++$ns }
Subroutine gen_ns: called CC=1 SCAR=0.0
753 184 ▶ sub gen_name { join '', $prefix, 'gensym', ++$name }
Subroutine gen_name: called CC=1 SCAR=0.0
754 19 ▶ sub prefix { $prefix =~ s/^[^\-]+-/$_[1]-/; $_[0]; }
Subroutine prefix: called CC=1 SCAR=0.0
755 }
756  
757 sub BEGIN {
758 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
759  
760 43 ▶ __PACKAGE__->__mk_accessors(qw(readable level seen autotype attr maptype
Subroutine BEGIN: called CC=2 SCAR=6.9
761 namespaces multirefinplace encoding signature on_nonserialized context
762 ns_uri ns_prefix use_default_ns));
763  
764 43 for my $method (qw(method fault freeform)) { # aliases for envelope
765 18 ▶ *$method = sub { shift->envelope($method => @_) }
Subroutine __ANON__: called CC=1 SCAR=0.0
766 129 }
767  
768 # Is this necessary? Seems like work for nothing when a user could just use
769 # SOAP::Utils directly.
770 # for my $method (qw(qualify overqualify disqualify)) { # import from SOAP::Utils
771 # *$method = \&{'SOAP::Utils::'.$method};
772 # }
773 }
774  
775 78 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
776  
777 sub new {
778 628 ▶ my $self = shift;
Subroutine new: called CC=7 SCAR=19.7
779 628 ▶ return $self if ref $self;
Branch: 1 branch
BranchTrueFalseTotal
if ref $self 550 78 628
780  
781 78 my $class = $self;
782 $self = bless {
783 _level => 0,
784 _autotype => 1,
785 _readable => 0,
786 _ns_uri => '',
787 _ns_prefix => '',
788 _use_default_ns => 1,
789 _multirefinplace => 0,
790 _seen => {},
791 _encoding => 'UTF-8',
792 _objectstack => {},
793 _signature => [],
794 _maptype => {},
795 _bodyattr => {},
796 _headerattr => {},
797 0 ▶ _on_nonserialized => sub {Carp::carp "Cannot marshall @{[ref shift]} reference" if $^W; return},
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 0 0
798 78 _encodingStyle => $SOAP::Constants::NS_ENC,
799 _attr => {
800 "{$SOAP::Constants::NS_ENV}encodingStyle" => $SOAP::Constants::NS_ENC,
801 },
802 _namespaces => {},
803 _soapversion => SOAP::Lite->soapversion,
804 } => $class;
805 $self->typelookup({
806 'base64Binary' =>
807 62 ▶ [10, sub {$_[0] =~ /[^\x09\x0a\x0d\x20-\x7f]/ }, 'as_base64Binary'],
Subroutine __ANON__: called CC=1 SCAR=0.0
808 'zerostring' =>
809 61 ▶ [12, sub { $_[0] =~ /^0\d+$/ }, 'as_string'],
Subroutine __ANON__: called CC=1 SCAR=0.0
810 # int (and actually long too) are subtle: the negative range is one greater...
811 'int' =>
812 60 ▶ [20, sub {$_[0] =~ /^([+-]?\d+)$/ && ($1 <= 2147483647) && ($1 >= -2147483648); }, 'as_int'],
Subroutine __ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
BranchTrueFalseTotal
$_[0] =~ /^([+-]?\d+)$/ and $1 <= 2147483647 and $1 >= '-2147483648' 36 24 60
Condition100%3/3
$_[0] =~ /^([+-]?\d+)$/ and $1 <= 2147483647
!ll&&!rl&&r
22236
MC/DC100%2/2
$_[0] =~ /^([+-]?\d+)$/ and $1 <= 2147483647
$_[0] =~ /^([+-]?\d+)$/ $1 <= 2147483647
Truth table100%3/3
A and B
A= $_[0] =~ /^([+-]?\d+)$/B= $1 <= 2147483647
ABresult
0X0
100
111
813 'long' =>
814 24 ▶ [25, sub {$_[0] =~ /^([+-]?\d+)$/ && $1 <= 9223372036854775807;}, 'as_long'],
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0] =~ /^([+-]?\d+)$/ and $1 <= '9223372036854775807' 2 22 24
815 'float' =>
816 22 ▶ [30, sub {$_[0] =~ /^(-?(?:\d+(?:\.\d*)?|\.\d+|NaN|INF)|([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?)$/}, 'as_float'],
Subroutine __ANON__: called CC=1 SCAR=0.0
817 'gMonth' =>
818 22 ▶ [35, sub { $_[0] =~ /^--\d\d--(-\d\d:\d\d)?$/; }, 'as_gMonth'],
Subroutine __ANON__: called CC=1 SCAR=0.0
819 'gDay' =>
820 22 ▶ [40, sub { $_[0] =~ /^---\d\d(-\d\d:\d\d)?$/; }, 'as_gDay'],
Subroutine __ANON__: called CC=1 SCAR=0.0
821 'gYear' =>
822 22 ▶ [45, sub { $_[0] =~ /^-?\d\d\d\d(-\d\d:\d\d)?$/; }, 'as_gYear'],
Subroutine __ANON__: called CC=1 SCAR=0.0
823 'gMonthDay' =>
824 22 ▶ [50, sub { $_[0] =~ /^-\d\d-\d\d(-\d\d:\d\d)?$/; }, 'as_gMonthDay'],
Subroutine __ANON__: called CC=1 SCAR=0.0
825 'gYearMonth' =>
826 22 ▶ [55, sub { $_[0] =~ /^-?\d\d\d\d-\d\d(Z|([+-]\d\d:\d\d))?$/; }, 'as_gYearMonth'],
Subroutine __ANON__: called CC=1 SCAR=0.0
827 'date' =>
828 22 ▶ [60, sub { $_[0] =~ /^-?\d\d\d\d-\d\d-\d\d(Z|([+-]\d\d:\d\d))?$/; }, 'as_date'],
Subroutine __ANON__: called CC=1 SCAR=0.0
829 'time' =>
830 22 ▶ [70, sub { $_[0] =~ /^\d\d:\d\d:\d\d(\.\d\d\d)?(Z|([+-]\d\d:\d\d))?$/; }, 'as_time'],
Subroutine __ANON__: called CC=1 SCAR=0.0
831 'dateTime' =>
832 22 ▶ [75, sub { $_[0] =~ /^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d\d)?(Z|([+-]\d\d:\d\d))?$/; }, 'as_dateTime'],
Subroutine __ANON__: called CC=1 SCAR=0.0
833 'duration' =>
834 22 ▶ [80, sub { $_[0] !~m{^-?PT?$} && $_[0] =~ m{^
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
not $_[0] =~ /^-?PT?$/ and $_[0] =~ /^ -? # a optional - sign P (:? \d+Y )? (:? \d+M )? (:? \d+D )? (:? T(:?\d+H)? (:?\d+M)? (:?\d+S)? )? $ /x 20 2 22
835 -? # a optional - sign
836 P
837 (:? \d+Y )?
838 (:? \d+M )?
839 (:? \d+D )?
840 (:?
841 T(:?\d+H)?
842 (:?\d+M)?
843 (:?\d+S)?
844 )?
845 $
846 }x;
847 }, 'as_duration'],
848 'boolean' =>
849 21 ▶ [90, sub { $_[0] =~ /^(true|false)$/i; }, 'as_boolean'],
Subroutine __ANON__: called CC=1 SCAR=0.0
850 'anyURI' =>
851 19 ▶ [95, sub { $_[0] =~ /^(urn:|http:\/\/)/i; }, 'as_anyURI'],
Subroutine __ANON__: called CC=1 SCAR=0.0
852 'string' =>
853 78 ▶ [100, sub {1}, 'as_string'],
Subroutine __ANON__: called CC=1 SCAR=0.0
854 });
855 78 $self->register_ns($SOAP::Constants::NS_ENC,$SOAP::Constants::PREFIX_ENC);
856 78 ▶ $self->register_ns($SOAP::Constants::NS_ENV,$SOAP::Constants::PREFIX_ENV)
Branch: 1 branch
BranchTrueFalseTotal
if $SOAP::Constants::PREFIX_ENV 78 0 78
857 if $SOAP::Constants::PREFIX_ENV;
858 78 $self->xmlschema($SOAP::Constants::DEFAULT_XML_SCHEMA);
859 78 SOAP::Trace::objects('()');
860  
861 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
862 78 ▶ Carp::carp "Odd (wrong?) number of parameters in new()" if $^W && (@_ & 1);
Branch: 1 branch
BranchTrueFalseTotal
if $^W and @_ & 1 0 78 78
Condition66%2/3
$^W and @_ & 1
!ll&&!rl&&r
7710
MC/DC0%0/2
$^W and @_ & 1
$^W @_ & 1
Truth table66%2/3
A and B
A= $^WB= @_ & 1
ABresult
0X0
100
111
863 78 ▶ while (@_) { my $method = shift; $self->$method(shift) if $self->can($method) }
Branch: 2 branches
BranchTrueFalseTotal
if (@_) 1 78 79
if $self->can($method) 1 0 1
864  
865 78 return $self;
866 }
867  
868 sub typelookup {
869 79 ▶ my ($self, $lookup) = @_;
Subroutine typelookup: called CC=2 SCAR=6.9
870 79 ▶ if (defined $lookup) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $lookup) 78 1 79
871 78 $self->{ _typelookup } = $lookup;
872 78 $self->{ _typelookup_order } = [ sort { $lookup->{$a}->[0] <=> $lookup->{$b}->[0] } keys %{ $lookup } ];
873 78 return $self;
874 }
875 1 return $self->{ _typelookup };
876 }
877  
878 sub ns {
879 3 ▶ my $self = shift;
Subroutine ns: called CC=6 SCAR=18.4
880 3 ▶ $self = $self->new() if not ref $self;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 2 1 3
881 3 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 3 0 3
882 3 my ($u,$p) = @_;
883 3 my $prefix;
884  
885 3 ▶ if ($p) {
Branch: 2 branches
BranchTrueFalseTotal
if ($p) { } 1 2 3
elsif (not $p || ($prefix = $self->find_prefix($u))) { } 2 0 2
886 1 $prefix = $p;
887 }
888 ▶ elsif (!$p && !($prefix = $self->find_prefix($u))) {
Condition33%1/3
$p || ($prefix = $self->find_prefix($u))
l!l&&r!l&&!r
002
MC/DC0%0/2
$p || ($prefix = $self->find_prefix($u))
$p ($prefix = $self->find_prefix($u))
Truth table33%1/3
A || B
A= $pB= ($prefix = $self->find_prefix($u))
ABresult
1X1
011
000
889 2 $prefix = gen_ns;
890 }
891  
892 3 $self->{'_ns_uri'} = $u;
893 3 $self->{'_ns_prefix'} = $prefix;
894 3 $self->{'_use_default_ns'} = 0;
895 # $self->register_ns($u,$prefix);
896 3 $self->{'_namespaces'}->{$u} = $prefix;
897 3 return $self;
898 }
899 0 return $self->{'_ns_uri'};
900 }
901  
902 sub default_ns {
903 33 ▶ my $self = shift;
Subroutine default_ns: called CC=3 SCAR=11.1
904 33 ▶ $self = $self->new() if not ref $self;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 1 32 33
905 33 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 33 0 33
906 33 my ($u) = @_;
907 33 $self->{'_ns_uri'} = $u;
908 33 $self->{'_ns_prefix'} = '';
909 33 $self->{'_use_default_ns'} = 1;
910 33 return $self;
911 }
912 0 return $self->{'_ns_uri'};
913 }
914  
915 sub use_prefix {
916 2 ▶ my $self = shift;
Subroutine use_prefix: called CC=4 SCAR=14.2
917 2 ▶ $self = $self->new() if not ref $self;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 2 0 2
918 2 warn 'use_prefix has been deprecated. if you wish to turn off or on the '
919 . 'use of a default namespace, then please use either ns(uri) or default_ns(uri)';
920 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2 0 2
921 2 my $use = shift;
922 2 ▶ $self->{'_use_default_ns'} = !$use || 0;
Condition100%2/2
!$use || 0
l!l
11
MC/DC100%1/1
!$use || 0
!$use
Truth table100%2/2
not(A)
A= !$use
Aresult
11
00
923 2 return $self;
924 } else {
925 0 return $self->{'_use_default_ns'};
926 }
927 }
928 sub uri {
929 49 ▶ my $self = shift;
Subroutine uri: called CC=4 SCAR=13.9
930 49 ▶ $self = $self->new() if not ref $self;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 0 49 49
931 # warn 'uri has been deprecated. if you wish to set the namespace for the request, then please use either ns(uri) or default_ns(uri)';
932 49 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 33 16 49
933 33 my $ns = shift;
934 33 ▶ if ($self->{_use_default_ns}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_use_default_ns'}) { } 32 1 33
935 32 $self->default_ns($ns);
936 }
937 else {
938 1 $self->ns($ns);
939 }
940 # $self->{'_ns_uri'} = $ns;
941 # $self->register_ns($self->{'_ns_uri'}) if (!$self->{_use_default_ns});
942 33 return $self;
943 }
944 16 return $self->{'_ns_uri'};
945 }
946  
947 sub encodingStyle {
948 6 ▶ my $self = shift;
Subroutine encodingStyle: called CC=4 SCAR=22.2
949 6 ▶ $self = $self->new() if not ref $self;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 0 6 6
950 6 ▶ return $self->{'_encodingStyle'} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 6 0 6
951  
952 0 my $cur_style = $self->{'_encodingStyle'};
953 0 delete($self->{'_namespaces'}->{$cur_style});
954  
955 0 my $new_style = shift;
956 0 ▶ if ($new_style eq "") {
Branch: 1 branch
BranchTrueFalseTotal
if ($new_style eq '') { } 0 0 0
957 0 delete($self->{'_attr'}->{"{$SOAP::Constants::NS_ENV}encodingStyle"});
958 }
959 else {
960 0 $self->{'_attr'}->{"{$SOAP::Constants::NS_ENV}encodingStyle"} = $new_style;
961 0 $self->{'_namespaces'}->{$new_style} = $SOAP::Constants::PREFIX_ENC;
962 }
963 }
964  
965 # TODO - changing SOAP version can affect previously set encodingStyle
966 sub soapversion {
967 57 ▶ my $self = shift;
Subroutine soapversion: called CC=4 SCAR=21.1
968 57 ▶ return $self->{_soapversion} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 57 57
969 57 ▶ return $self if $self->{_soapversion} eq SOAP::Lite->soapversion;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_soapversion"} eq "SOAP::Lite"->soapversion 57 0 57
970 0 $self->{_soapversion} = shift;
971  
972 0 $self->attr({
973 "{$SOAP::Constants::NS_ENV}encodingStyle" => $SOAP::Constants::NS_ENC,
974 });
975 0 ▶ $self->namespaces({
Branch: 1 branch
BranchTrueFalseTotal
$SOAP::Constants::PREFIX_ENV ? : 0 0 0
976 $SOAP::Constants::NS_ENC => $SOAP::Constants::PREFIX_ENC,
977 $SOAP::Constants::PREFIX_ENV ? ($SOAP::Constants::NS_ENV => $SOAP::Constants::PREFIX_ENV) : (),
978 });
979 0 $self->xmlschema($SOAP::Constants::DEFAULT_XML_SCHEMA);
980  
981 0 return $self;
982 }
983  
984 sub xmlschema {
985 98 ▶ my $self = shift->new;
Subroutine xmlschema: called CC=9 SCAR=22.7
986 98 ▶ return $self->{_xmlschema} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 98 98
987  
988 98 my @schema;
989 98 ▶ if ($_[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]) 98 0 98
990 98 ▶ @schema = grep {/XMLSchema/ && /$_[0]/} keys %SOAP::Constants::XML_SCHEMAS;
Branch: 1 branch
BranchTrueFalseTotal
/XMLSchema/ and /$_[0]/ 196 196 392
991 98 ▶ Carp::croak "More than one schema match parameter '$_[0]': @{[join ', ', @schema]}" if @schema > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @schema > 1 0 98 98
992 98 ▶ Carp::croak "No schema match parameter '$_[0]'" if @schema != 1;
Branch: 1 branch
BranchTrueFalseTotal
if @schema != 1 0 98 98
993 }
994  
995 # do nothing if current schema is the same as new
996 # return $self if $self->{_xmlschema} && $self->{_xmlschema} eq $schema[0];
997  
998 98 my $ns = $self->namespaces;
999 # delete current schema from namespaces
1000 98 ▶ if (my $schema = $self->{_xmlschema}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $schema = $self->{"_xmlschema"}) 20 78 98
1001 20 delete $ns->{$schema};
1002 20 delete $ns->{"$schema-instance"};
1003 }
1004  
1005 # add new schema into namespaces
1006 98 ▶ if (my $schema = $self->{_xmlschema} = shift @schema) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $schema = $self->{"_xmlschema"} = shift @schema) 98 0 98
1007 98 $ns->{$schema} = 'xsd';
1008 98 $ns->{"$schema-instance"} = 'xsi';
1009 }
1010  
1011 # and here is the class serializer should work with
1012 my $class = exists $SOAP::Constants::XML_SCHEMAS{$self->{_xmlschema}}
1013 98 ▶ ? $SOAP::Constants::XML_SCHEMAS{$self->{_xmlschema}} . '::Serializer'
Branch: 1 branch
BranchTrueFalseTotal
exists $SOAP::Constants::XML_SCHEMAS{$self->{'_xmlschema'}} ? : 98 0 98
1014 : $self;
1015  
1016 98 $self->xmlschemaclass($class);
1017  
1018 98 return $self;
1019 }
1020  
1021 sub headerattr {
1022 0 ▶ my $self = shift->new();
Subroutine headerattr: not called CC=2 SCAR=17.9
1023 0 ▶ return $self->{_headerattr} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
1024 0 $self->{_headerattr} = shift;
1025 0 return $self;
1026 }
1027 sub bodyattr {
1028 59 ▶ my $self = shift->new();
Subroutine bodyattr: called CC=2 SCAR=9.2
1029 59 ▶ return $self->{_bodyattr} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 59 0 59
1030 0 $self->{_bodyattr} = shift;
1031 0 return $self;
1032 }
1033  
1034 sub envprefix {
1035 148 ▶ my $self = shift->new();
Subroutine envprefix: called CC=2 SCAR=9.2
1036 148 ▶ return $self->namespaces->{$SOAP::Constants::NS_ENV} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 148 0 148
1037 0 $self->namespaces->{$SOAP::Constants::NS_ENV} = shift;
1038 0 return $self;
1039 }
1040  
1041 sub encprefix {
1042 6 ▶ my $self = shift->new();
Subroutine encprefix: called CC=2 SCAR=9.2
1043 6 ▶ return $self->namespaces->{$SOAP::Constants::NS_ENC} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 6 0 6
1044 0 $self->namespaces->{$SOAP::Constants::NS_ENC} = shift;
1045 0 return $self;
1046 }
1047  
1048 730 ▶sub gen_id { sprintf "%U", $_[1] }
Subroutine gen_id: called CC=1 SCAR=0.0
1049  
1050 sub multiref_object {
1051 536 ▶ my ($self, $object) = @_;
Subroutine multiref_object: called CC=3 SCAR=11.0
1052 536 my $id = $self->gen_id($object);
1053 536 ▶ if (! exists $self->{ _seen }->{ $id }) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $self->{'_seen'}{$id}) { } 524 12 536
1054 524 $self->{ _seen }->{ $id } = {
1055 count => 1,
1056 multiref => 0,
1057 value => $object,
1058 recursive => 0
1059 };
1060 }
1061 else {
1062 12 my $id_seen = $self->{ _seen }->{ $id };
1063 12 $id_seen->{count}++;
1064 12 $id_seen->{multiref} = 1;
1065 12 $id_seen->{value} = $object;
1066 12 ▶ $id_seen->{recursive} ||= 0;
Condition100%2/2
$id_seen->{"recursive"} ||= 0
l!l
210
MC/DC100%1/1
$id_seen->{"recursive"} ||= 0
$id_seen->{"recursive"}
Truth table100%2/2
A
A= $id_seen->{"recursive"}
Aresult
11
00
1067 }
1068 536 return $id;
1069 }
1070  
1071 sub recursive_object {
1072 0 ▶ my $self = shift;
Subroutine recursive_object: not called CC=1 SCAR=6.9
1073 0 $self->seen->{$self->gen_id(shift)}->{recursive} = 1;
1074 }
1075  
1076 sub is_href {
1077 187 ▶ my $self = shift;
Subroutine is_href: called CC=8 SCAR=21.0
1078 187 ▶ my $seen = $self->seen->{shift || return} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $seen = $self->seen->{shift() or return} or return 0 187 187
Condition50%1/2
shift() || (return)
l!l
1870
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
1079 187 ▶ return 1 if $seen->{id};
Branch: 1 branch
BranchTrueFalseTotal
if $seen->{"id"} 3 184 187
1080 return $seen->{multiref}
1081 && !($seen->{id} = (shift
1082 || $seen->{recursive}
1083 184 ▶ || $seen->{multiref} && $self->multirefinplace));
Condition91%11/12
$seen->{'multiref'} && !($seen->{'id'} = shift() || $seen->{'recursive'} || $seen->{'multiref'} && $self->multirefinplace)
!ll&&!rl&&r
17752
shift() || $seen->{'recursive'} || $seen->{'multiref'} && $self->multirefinplace
l!l&&r!l&&!r
412
shift() or $seen->{"recursive"}
l!l&&r!l&&!r
133
$seen->{"multiref"} and $self->multirefinplace
!ll&&!rl&&r
021
MC/DC80%4/5
$seen->{'multiref'} && !($seen->{'id'} = shift() || $seen->{'recursive'} || $seen->{'multiref'} && $self->multirefinplace)
$seen->{'multiref'} shift() $seen->{"recursive"} $seen->{"multiref"} $self->multirefinplace
Truth table83%5/6
A && not(B or C || D and E)
A= $seen->{'multiref'}B= shift()C= $seen->{"recursive"}D= $seen->{"multiref"}E= $self->multirefinplace
ABCDEresult
0XXXX0
11XXX0
101XX0
100110
1000X1
100101
1084 }
1085  
1086 sub multiref_anchor {
1087 10 ▶ my ($self, $id) = @_;
Subroutine multiref_anchor: called CC=2 SCAR=7.1
1088 43 ▶ no warnings qw(uninitialized);
Subroutine BEGIN: called CC=1 SCAR=0.0
1089 10 ▶ if ($self->{ _seen }->{ $id }->{multiref}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_seen'}{$id}{'multiref'}) { } 10 0 10
1090 10 return "ref-$id"
1091 }
1092 else {
1093 0 return undef;
1094 }
1095 }
1096  
1097 sub encode_multirefs {
1098 70 ▶ my $self = shift;
Subroutine encode_multirefs: called CC=3 SCAR=11.0
1099 70 ▶ return if $self->multirefinplace();
Branch: 1 branch
BranchTrueFalseTotal
if $self->multirefinplace 1 69 70
1100  
1101 69 my $seen = $self->{ _seen };
1102 1 map { $_->[1]->{_id} = 1; $_ }
1103 1 map { $self->encode_object($seen->{$_}->{value}) }
1104 69 ▶ grep { $seen->{$_}->{multiref} && !$seen->{$_}->{recursive} }
Branch: 1 branch
BranchTrueFalseTotal
$seen->{$_}{"multiref"} and not $seen->{$_}{"recursive"} 4 507 511
1105 keys %$seen;
1106 }
1107  
1108 sub maptypetouri {
1109 184 ▶ my($self, $type, $simple) = @_;
Subroutine maptypetouri: called CC=7 SCAR=19.9
1110  
1111 184 ▶ return $type unless defined $type;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type 177 7 184
1112 7 my($prefix, $name) = SOAP::Utils::splitqname($type);
1113  
1114 7 ▶ unless (defined $prefix) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $prefix) 5 2 7
1115 5 $name =~ s/__|\./::/g;
1116 $self->maptype->{$name} = $simple
1117 ? die "Schema/namespace for type '$type' is not specified\n"
1118 : $SOAP::Constants::NS_SL_PERLTYPE
1119 5 ▶ unless exists $self->maptype->{$name};
Branch: 2 branches
BranchTrueFalseTotal
unless exists $self->maptype->{$name} 5 0 5
$simple ? : 1 4 5
1120 $type = $self->maptype->{$name}
1121 4 ▶ ? SOAP::Utils::qualify($self->namespaces->{$self->maptype->{$name}} ||= gen_ns, $type)
Branch: 1 branch
BranchTrueFalseTotal
$self->maptype->{$name} ? : 4 0 4
Condition33%1/3
$self->namespaces->{$self->maptype->{$name}} ||= gen_ns()
l!l&&r!l&&!r
040
MC/DC0%0/2
$self->namespaces->{$self->maptype->{$name}} ||= gen_ns()
$self->namespaces->{$self->maptype->{$name}} gen_ns()
Truth table33%1/3
A ||= B
A= $self->namespaces->{$self->maptype->{$name}}B= gen_ns()
ABresult
1X1
011
000
1122 : undef;
1123 }
1124 6 return $type;
1125 }
1126  
1127 sub encode_object {
1128 599 ▶ my($self, $object, $name, $type, $attr) = @_;
Subroutine encode_object: called CC=31 SCAR=35.7
1129  
1130 599 ▶ $attr ||= {};
Condition100%2/2
$attr ||= {}
l!l
325274
MC/DC100%1/1
$attr ||= {}
$attr
Truth table100%2/2
A
A= $attr
Aresult
11
00
1131 599 ▶ return $self->encode_scalar($object, $name, $type, $attr)
Branch: 1 branch
BranchTrueFalseTotal
unless ref $object 63 536 599
1132 unless ref $object;
1133  
1134 536 my $id = $self->multiref_object($object);
1135  
1136 43 ▶ use vars '%objectstack'; # we'll play with symbol table
Subroutine BEGIN: called CC=1 SCAR=0.0
1137 536 local %objectstack = %objectstack; # want to see objects ONLY in the current tree
1138  
1139 # did we see this object in current tree? Seems to be recursive refs
1140 # same as call to $self->recursive_object($object) - but
1141 # recursive_object($object) has to re-compute the object's id
1142 536 ▶ if (++$objectstack{ $id } > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$SOAP::Serializer::objectstack{$id} > 1) 5 531 536
1143 5 $self->{ _seen }->{ $id }->{recursive} = 1
1144 }
1145  
1146 # return if we already saw it twice. It should be already properly serialized
1147 536 ▶ return if $objectstack{$id} > 2;
Branch: 1 branch
BranchTrueFalseTotal
if $SOAP::Serializer::objectstack{$id} > 2 2 534 536
1148  
1149 534 ▶ if (UNIVERSAL::isa($object => 'SOAP::Data')) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::isa($object, "SOAP::Data")) 342 192 534
1150 # use $object->SOAP::Data:: to enable overriding name() and others in inherited classes
1151 342 ▶ $object->SOAP::Data::name($name)
Branch: 1 branch
BranchTrueFalseTotal
unless defined $object->SOAP::Data::name 115 227 342
1152 unless defined $object->SOAP::Data::name;
1153  
1154 # apply ->uri() and ->prefix() which can modify name and attributes of
1155 # element, but do not modify SOAP::Data itself
1156 342 my($name, $attr) = $self->fixattrs($object);
1157 342 $attr = $self->attrstoqname($attr);
1158  
1159 342 my @realvalues = $object->SOAP::Data::value;
1160 342 ▶ return [$name || gen_name, $attr] unless @realvalues;
Branch: 1 branch
BranchTrueFalseTotal
unless @realvalues 4 338 342
Condition33%1/3
$name || gen_name()
l!l&&r!l&&!r
400
MC/DC0%0/2
$name || gen_name()
$name gen_name()
Truth table33%1/3
A || B
A= $nameB= gen_name()
ABresult
1X1
011
000
1161  
1162 338 ▶ my $method = "as_" . ($object->SOAP::Data::type || '-'); # dummy type if not defined
Condition100%2/2
$object->SOAP::Data::type || '-'
l!l
6332
MC/DC100%1/1
$object->SOAP::Data::type || '-'
$object->SOAP::Data::type
Truth table100%2/2
A
A= $object->SOAP::Data::type
Aresult
11
00
1163 # try to call method specified for this type
1164 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
1165 my @values = map {
1166 # store null/nil attribute if value is undef
1167 338 ▶ local $attr->{SOAP::Utils::qualify(xsi => $self->xmlschemaclass->nilValue)} = $self->xmlschemaclass->as_undef(1)
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_ 17 344 361
1168 unless defined;
1169 361 ▶ $self->can($method) && $self->$method($_, $name || gen_name, $object->SOAP::Data::type, $attr)
Branch: 1 branch
BranchTrueFalseTotal
$self->can($method) and $self->$method($_, $name || gen_name(), $object->SOAP::Data::type, $attr) or $self->typecast($_, $name || gen_name(), $object->SOAP::Data::type, $attr) or $self->encode_object($_, $name, $object->SOAP::Data::type, $attr) 323 37 360
Condition75%9/12
$self->can($method) and $self->$method($_, $name || gen_name(), $object->SOAP::Data::type, $attr) or $self->typecast($_, $name || gen_name(), $object->SOAP::Data::type, $attr)
l!l&&r!l&&!r
433324
$self->can($method) and $self->$method($_, $name || gen_name(), $object->SOAP::Data::type, $attr)
!ll&&!rl&&r
35704
$name || gen_name()
l!l&&r!l&&!r
130
$name || gen_name()
l!l&&r!l&&!r
2231340
MC/DC0%0/3
$self->can($method) and $self->$method($_, $name || gen_name(), $object->SOAP::Data::type, $attr) or $self->typecast($_, $name || gen_name(), $object->SOAP::Data::type, $attr)
$self->can($method) $self->$method($_, $name || gen_name(), $object->SOAP::Data::type, $attr) $self->typecast($_, $name || gen_name(), $object->SOAP::Data::type, $attr)
MC/DC0%0/2
$name || gen_name()
$name gen_name()
MC/DC0%0/2
$name || gen_name()
$name gen_name()
Truth table0%0/5
A and B or C
A= $self->can($method)B= $self->$method($_, $name || gen_name(), $object->SOAP::Data::type, $attr)C= $self->typecast($_, $name || gen_name(), $object->SOAP::Data::type, $attr)
ABCresult
11X1
0X11
1011
0X00
1000
Truth table66%2/3
A || B
A= $nameB= gen_name()
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= $nameB= gen_name()
ABresult
1X1
011
000
1170 || $self->typecast($_, $name || gen_name, $object->SOAP::Data::type, $attr)
1171 || $self->encode_object($_, $name, $object->SOAP::Data::type, $attr)
1172 } @realvalues;
1173 337 ▶ $object->SOAP::Data::signature([map {join $;, $_->[0], SOAP::Utils::disqualify($_->[1]->{'xsi:type'} || '')} @values]) if @values;
Branch: 1 branch
BranchTrueFalseTotal
if @values 337 0 337
Condition100%2/2
$_->[1]{'xsi:type'} || ''
l!l
49311
MC/DC100%1/1
$_->[1]{'xsi:type'} || ''
$_->[1]{'xsi:type'}
Truth table100%2/2
A
A= $_->[1]{'xsi:type'}
Aresult
11
00
1174 337 ▶ return wantarray ? @values : $values[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 336 1 337
1175 }
1176  
1177 192 my $class = ref $object;
1178  
1179 192 ▶ if ($class !~ /^(?:SCALAR|ARRAY|HASH|REF)$/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($class =~ /^(?:SCALAR|ARRAY|HASH|REF)$/o) 3 189 192
1180 # we could also check for CODE|GLOB|LVALUE, but we cannot serialize
1181 # them anyway, so they'll be caught by check below
1182 3 $class =~ s/::/__/g;
1183  
1184 3 ▶ $name = $class if !defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 2 1 3
1185 3 ▶ $type = $class if !defined $type && $self->autotype;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $type and $self->autotype 3 0 3
Condition33%1/3
not defined $type and $self->autotype
!ll&&!rl&&r
003
MC/DC0%0/2
not defined $type and $self->autotype
not defined $type $self->autotype
Truth table33%1/3
not(A) and B
A= not defined $typeB= $self->autotype
ABresult
0X0
100
111
1186  
1187 3 my $method = 'as_' . $class;
1188 3 ▶ if ($self->can($method)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can($method)) 0 3 3
1189 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
1190 0 my $encoded = $self->$method($object, $name, $type, $attr);
1191 0 ▶ return $encoded if ref $encoded;
Branch: 1 branch
BranchTrueFalseTotal
if ref $encoded 0 0 0
1192 # return only if handled, otherwise handle with default handlers
1193 }
1194 }
1195  
1196 192 ▶ if (UNIVERSAL::isa($object => 'REF') || UNIVERSAL::isa($object => 'SCALAR')) {
Branch: 3 branches
BranchTrueFalseTotal
if (UNIVERSAL::isa($object, 'REF') or UNIVERSAL::isa($object, 'SCALAR')) { } 176 16 192
elsif (UNIVERSAL::isa($object, 'ARRAY')) { } 6 10 16
elsif (UNIVERSAL::isa($object, 'HASH')) { } 10 0 10
Condition100%3/3
UNIVERSAL::isa($object, "REF") or UNIVERSAL::isa($object, "SCALAR")
l!l&&r!l&&!r
170616
MC/DC100%2/2
UNIVERSAL::isa($object, "REF") or UNIVERSAL::isa($object, "SCALAR")
UNIVERSAL::isa($object, "REF") UNIVERSAL::isa($object, "SCALAR")
Truth table100%3/3
A or B
A= UNIVERSAL::isa($object, "REF")B= UNIVERSAL::isa($object, "SCALAR")
ABresult
1X1
011
000
1197 176 return $self->encode_scalar($object, $name, $type, $attr);
1198 }
1199 elsif (UNIVERSAL::isa($object => 'ARRAY')) {
1200 # Added in SOAP::Lite 0.65_6 to fix an XMLRPC bug
1201 6 ▶ return $self->encodingStyle eq ""
Branch: 1 branch
BranchTrueFalseTotal
$self->encodingStyle eq '' || $self->isa('XMLRPC::Serializer') ? : 0 6 6
Condition33%1/3
$self->encodingStyle eq "" or $self->isa("XMLRPC::Serializer")
l!l&&r!l&&!r
006
MC/DC0%0/2
$self->encodingStyle eq "" or $self->isa("XMLRPC::Serializer")
$self->encodingStyle eq "" $self->isa("XMLRPC::Serializer")
Truth table33%1/3
A or B
A= $self->encodingStyle eq ""B= $self->isa("XMLRPC::Serializer")
ABresult
1X1
011
000
1202 || $self->isa('XMLRPC::Serializer')
1203 ? $self->encode_array($object, $name, $type, $attr)
1204 : $self->encode_literal_array($object, $name, $type, $attr);
1205 }
1206 elsif (UNIVERSAL::isa($object => 'HASH')) {
1207 10 return $self->encode_hash($object, $name, $type, $attr);
1208 }
1209 else {
1210 0 return $self->on_nonserialized->($object);
1211 }
1212 }
1213  
1214 sub encode_scalar {
1215 254 ▶ my($self, $value, $name, $type, $attr) = @_;
Subroutine encode_scalar: called CC=9 SCAR=22.3
1216 254 ▶ $name ||= gen_name;
Condition66%2/3
$name ||= gen_name()
l!l&&r!l&&!r
212420
MC/DC0%0/2
$name ||= gen_name()
$name gen_name()
Truth table66%2/3
A ||= B
A= $nameB= gen_name()
ABresult
1X1
011
000
1217  
1218 254 my $schemaclass = $self->xmlschemaclass;
1219  
1220 # null reference
1221 254 ▶ return [$name, {%$attr, SOAP::Utils::qualify(xsi => $schemaclass->nilValue) => $schemaclass->as_undef(1)}] unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 13 241 254
1222  
1223 # object reference
1224 241 ▶ return [$name, {'xsi:type' => $self->maptypetouri($type), %$attr}, [$self->encode_object($$value)], $self->gen_id($value)] if ref $value;
Branch: 1 branch
BranchTrueFalseTotal
if ref $value 176 65 241
1225  
1226 # autodefined type
1227 65 ▶ if ($self->{ _autotype}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_autotype"}) 63 2 65
1228 63 my $lookup = $self->{_typelookup};
1229 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
1230 #for (sort {$lookup->{$a}->[0] <=> $lookup->{$b}->[0]} keys %$lookup) {
1231 63 for (@{ $self->{ _typelookup_order } }) {
1232 483 my $method = $lookup->{$_}->[2];
1233 return $self->can($method) && $self->$method($value, $name, $type, $attr)
1234 || $method->($value, $name, $type, $attr)
1235 483 ▶ if $lookup->{$_}->[1]->($value);
Branch: 1 branch
BranchTrueFalseTotal
if $lookup->{$_}[1]->($value) 63 420 483
Condition33%2/6
$self->can($method) && $self->$method($value, $name, $type, $attr) || &$method($value, $name, $type, $attr)
l!l&&r!l&&!r
6300
$self->can($method) and $self->$method($value, $name, $type, $attr)
!ll&&!rl&&r
0063
MC/DC0%0/3
$self->can($method) && $self->$method($value, $name, $type, $attr) || &$method($value, $name, $type, $attr)
$self->can($method) $self->$method($value, $name, $type, $attr) &$method($value, $name, $type, $attr)
Truth table20%1/5
A and B || C
A= $self->can($method)B= $self->$method($value, $name, $type, $attr)C= &$method($value, $name, $type, $attr)
ABCresult
11X1
0X11
1011
0X00
1000
1236 }
1237 }
1238  
1239 # invariant
1240 2 return [$name, $attr, $value];
1241 }
1242  
1243 sub encode_array {
1244 0 ▶ my ($self, $array, $name, $type, $attr) = @_;
Subroutine encode_array: not called CC=9 SCAR=45.0
1245 0 my $items = 'item';
1246  
1247 # If typing is disabled, just serialize each of the array items
1248 # with no type information, each using the specified name,
1249 # and do not create a wrapper array tag.
1250 0 ▶ if (!$self->autotype) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->autotype) 0 0 0
1251 0 ▶ $name ||= gen_name;
Condition0%0/3
$name ||= gen_name()
l!l&&r!l&&!r
000
MC/DC0%0/2
$name ||= gen_name()
$name gen_name()
Truth table0%0/3
A ||= B
A= $nameB= gen_name()
ABresult
1X1
011
000
1252 0 return map {$self->encode_object($_, $name)} @$array;
1253 }
1254  
1255 # TODO: add support for multidimensional, partially transmitted and sparse arrays
1256 0 my @items = map {$self->encode_object($_, $items)} @$array;
1257 0 my $num = @items;
1258 0 my($arraytype, %types) = '-';
1259 0 ▶ for (@items) { $arraytype = $_->[1]->{'xsi:type'} || '-'; $types{$arraytype}++ }
Condition0%0/2
$_->[1]{'xsi:type'} || '-'
l!l
00
MC/DC0%0/1
$_->[1]{'xsi:type'} || '-'
$_->[1]{'xsi:type'}
Truth table0%0/2
A
A= $_->[1]{'xsi:type'}
Aresult
11
00
1260 0 ▶ $arraytype = sprintf "%s\[$num]", keys %types > 1 || $arraytype eq '-' ? SOAP::Utils::qualify(xsd => $self->xmlschemaclass->anyTypeValue) : $arraytype;
Branch: 1 branch
BranchTrueFalseTotal
keys %types > 1 || $arraytype eq '-' ? : 0 0 0
Condition0%0/3
keys %types > 1 or $arraytype eq "-"
l!l&&r!l&&!r
000
MC/DC0%0/2
keys %types > 1 or $arraytype eq "-"
keys %types > 1 $arraytype eq "-"
Truth table0%0/3
A or B
A= keys %types > 1B= $arraytype eq "-"
ABresult
1X1
011
000
1261  
1262 # $type = SOAP::Utils::qualify($self->encprefix => 'Array') if $self->autotype && !defined $type;
1263 0 ▶ $type = qualify($self->encprefix => 'Array') if !defined $type;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type 0 0 0
1264 0 ▶ return [$name || SOAP::Utils::qualify($self->encprefix => 'Array'),
Condition0%0/3
$name || SOAP::Utils::qualify($self->encprefix, 'Array')
l!l&&r!l&&!r
000
MC/DC0%0/2
$name || SOAP::Utils::qualify($self->encprefix, 'Array')
$name SOAP::Utils::qualify($self->encprefix, 'Array')
Truth table0%0/3
A || B
A= $nameB= SOAP::Utils::qualify($self->encprefix, 'Array')
ABresult
1X1
011
000
1265 {
1266 SOAP::Utils::qualify($self->encprefix => 'arrayType') => $arraytype,
1267 'xsi:type' => $self->maptypetouri($type), %$attr
1268 },
1269 [@items],
1270 $self->gen_id($array)
1271 ];
1272 }
1273  
1274 # Will encode arrays using doc-literal style
1275 sub encode_literal_array {
1276 6 ▶ my($self, $array, $name, $type, $attr) = @_;
Subroutine encode_literal_array: called CC=11 SCAR=24.0
1277  
1278 6 ▶ if ($self->autotype) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->autotype) { } 3 3 6
1279 3 my $items = 'item';
1280  
1281 # TODO: add support for multidimensional, partially transmitted and sparse arrays
1282 3 my @items = map {$self->encode_object($_, $items)} @$array;
1283  
1284  
1285 3 my $num = @items;
1286 3 my($arraytype, %types) = '-';
1287 3 for (@items) {
1288 6 ▶ $arraytype = $_->[1]->{'xsi:type'} || '-';
Condition100%2/2
$_->[1]{'xsi:type'} || '-'
l!l
42
MC/DC100%1/1
$_->[1]{'xsi:type'} || '-'
$_->[1]{'xsi:type'}
Truth table100%2/2
A
A= $_->[1]{'xsi:type'}
Aresult
11
00
1289 6 $types{$arraytype}++
1290 }
1291 3 ▶ $arraytype = sprintf "%s\[$num]", keys %types > 1 || $arraytype eq '-'
Branch: 1 branch
BranchTrueFalseTotal
keys %types > 1 || $arraytype eq '-' ? : 2 1 3
Condition100%3/3
keys %types > 1 or $arraytype eq "-"
l!l&&r!l&&!r
111
MC/DC100%2/2
keys %types > 1 or $arraytype eq "-"
keys %types > 1 $arraytype eq "-"
Truth table100%3/3
A or B
A= keys %types > 1B= $arraytype eq "-"
ABresult
1X1
011
000
1292 ? SOAP::Utils::qualify(xsd => $self->xmlschemaclass->anyTypeValue)
1293 : $arraytype;
1294  
1295 3 ▶ $type = SOAP::Utils::qualify($self->encprefix => 'Array')
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type 2 1 3
1296 if !defined $type;
1297  
1298 3 ▶ return [$name || SOAP::Utils::qualify($self->encprefix => 'Array'),
Condition66%2/3
$name || SOAP::Utils::qualify($self->encprefix, 'Array')
l!l&&r!l&&!r
210
MC/DC0%0/2
$name || SOAP::Utils::qualify($self->encprefix, 'Array')
$name SOAP::Utils::qualify($self->encprefix, 'Array')
Truth table66%2/3
A || B
A= $nameB= SOAP::Utils::qualify($self->encprefix, 'Array')
ABresult
1X1
011
000
1299 {
1300 SOAP::Utils::qualify($self->encprefix => 'arrayType') => $arraytype,
1301 'xsi:type' => $self->maptypetouri($type), %$attr
1302 },
1303 [ @items ],
1304 $self->gen_id($array)
1305 ];
1306 }
1307 else {
1308 #
1309 # literal arrays are different - { array => [ 5,6 ] }
1310 # results in <array>5</array><array>6</array>
1311 # This means that if there's a literal inside the array (not a
1312 # reference), we have to encode it this way. If there's only
1313 # nested tags, encode as
1314 # <array><foo>1</foo><foo>2</foo></array>
1315 #
1316  
1317 3 my $literal = undef;
1318 my @items = map {
1319 3 ref $_
1320 ? $self->encode_object($_)
1321 6 ▶ : do {
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 2 4 6
1322 4 $literal++;
1323 4 $_
1324 }
1325  
1326 } @$array;
1327  
1328 3 ▶ if ($literal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($literal) { } 2 1 3
1329 2 return map { [ $name , $attr , $_, $self->gen_id($array) ] } @items;
1330 }
1331 else {
1332 1 ▶ return [$name || SOAP::Utils::qualify($self->encprefix => 'Array'),
Condition33%1/3
$name || SOAP::Utils::qualify($self->encprefix, 'Array')
l!l&&r!l&&!r
100
MC/DC0%0/2
$name || SOAP::Utils::qualify($self->encprefix, 'Array')
$name SOAP::Utils::qualify($self->encprefix, 'Array')
Truth table33%1/3
A || B
A= $nameB= SOAP::Utils::qualify($self->encprefix, 'Array')
ABresult
1X1
011
000
1333 $attr,
1334 [ @items ],
1335 $self->gen_id($array)
1336 ];
1337 }
1338 }
1339 }
1340  
1341 sub encode_hash {
1342 10 ▶ my($self, $hash, $name, $type, $attr) = @_;
Subroutine encode_hash: called CC=11 SCAR=30.6
1343  
1344 10 ▶ if ($self->autotype && grep {!/$SOAP::Constants::ELMASK/o} keys %$hash) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->autotype and grep {not /$SOAP::Constants::ELMASK/o;} keys %$hash) 0 10 10
Condition66%2/3
$self->autotype and grep {not /$SOAP::Constants::ELMASK/o;} keys %$hash
!ll&&!rl&&r
640
MC/DC0%0/2
$self->autotype and grep {not /$SOAP::Constants::ELMASK/o;} keys %$hash
$self->autotype grep {not /$SOAP::Constants::ELMASK/o;} keys %$hash
Truth table66%2/3
A and B
A= $self->autotypeB= grep {not /$SOAP::Constants::ELMASK/o;} keys %$hash
ABresult
0X0
100
111
1345 0 ▶ warn qq!Cannot encode @{[$name ? "'$name'" : 'unnamed']} element as 'hash'. Will be encoded as 'map' instead\n! if $^W;
Branch: 2 branches
BranchTrueFalseTotal
if $^W 0 0 0
$name ? : 0 0 0
1346 0 ▶ return $self->as_map($hash, $name || gen_name, $type, $attr);
Condition0%0/3
$name || gen_name()
l!l&&r!l&&!r
000
MC/DC0%0/2
$name || gen_name()
$name gen_name()
Truth table0%0/3
A || B
A= $nameB= gen_name()
ABresult
1X1
011
000
1347 }
1348  
1349 $type = 'SOAPStruct'
1350 10 ▶ if $self->autotype && !defined($type) && exists $self->maptype->{SOAPStruct};
Branch: 1 branch
BranchTrueFalseTotal
if $self->autotype and not defined $type and exists $self->maptype->{"SOAPStruct"} 0 10 10
Condition83%5/6
$self->autotype and not defined $type and exists $self->maptype->{"SOAPStruct"}
!ll&&!rl&&r
910
$self->autotype and not defined $type
!ll&&!rl&&r
631
MC/DC0%0/3
$self->autotype and not defined $type and exists $self->maptype->{"SOAPStruct"}
$self->autotype not defined $type exists $self->maptype->{"SOAPStruct"}
Truth table75%3/4
A and not(B) and C
A= $self->autotypeB= not defined $typeC= exists $self->maptype->{"SOAPStruct"}
ABCresult
0XX0
10X0
1100
1111
1351 return [$name || gen_name,
1352 $self->autotype ? {'xsi:type' => $self->maptypetouri($type), %$attr} : { %$attr },
1353 10 ▶ [map {$self->encode_object($hash->{$_}, $_)} keys %$hash],
Branch: 1 branch
BranchTrueFalseTotal
$self->autotype ? : 4 6 10
Condition66%2/3
$name || gen_name()
l!l&&r!l&&!r
640
MC/DC0%0/2
$name || gen_name()
$name gen_name()
Truth table66%2/3
A || B
A= $nameB= gen_name()
ABresult
1X1
011
000
1354 $self->gen_id($hash)
1355 ];
1356 }
1357  
1358 sub as_ordered_hash {
1359 0 ▶ my ($self, $value, $name, $type, $attr) = @_;
Subroutine as_ordered_hash: not called CC=2 SCAR=17.9
1360 0 ▶ die "Not an ARRAY reference for 'ordered_hash' type" unless UNIVERSAL::isa($value => 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
unless UNIVERSAL::isa($value, "ARRAY") 0 0 0
1361 return [ $name, $attr,
1362 0 [map{$self->encode_object(@{$value}[2*$_+1,2*$_])} 0..$#$value/2 ],
1363 $self->gen_id($value)
1364 ];
1365 }
1366  
1367 sub as_map {
1368 0 ▶ my ($self, $value, $name, $type, $attr) = @_;
Subroutine as_map: not called CC=3 SCAR=24.8
1369 0 ▶ die "Not a HASH reference for 'map' type" unless UNIVERSAL::isa($value => 'HASH');
Branch: 1 branch
BranchTrueFalseTotal
unless UNIVERSAL::isa($value, "HASH") 0 0 0
1370 0 ▶ my $prefix = ($self->namespaces->{$SOAP::Constants::NS_APS} ||= 'apachens');
Condition0%0/2
$self->namespaces->{$SOAP::Constants::NS_APS} ||= "apachens"
l!l
00
MC/DC0%0/1
$self->namespaces->{$SOAP::Constants::NS_APS} ||= "apachens"
$self->namespaces->{$SOAP::Constants::NS_APS}
Truth table0%0/2
A
A= $self->namespaces->{$SOAP::Constants::NS_APS}
Aresult
11
00
1371 my @items = map {
1372 0 $self->encode_object(
1373 SOAP::Data->type(
1374 ordered_hash => [
1375 key => $_,
1376 0 value => $value->{$_}
1377 ]
1378 ),
1379 'item',
1380 ''
1381 )} sort keys %$value;
1382 return [
1383 0 $name,
1384 {'xsi:type' => "$prefix:Map", %$attr},
1385 [@items],
1386 $self->gen_id($value)
1387 ];
1388 }
1389  
1390 sub as_xml {
1391 0 ▶ my $self = shift;
Subroutine as_xml: not called CC=1 SCAR=6.9
1392 0 my($value, $name, $type, $attr) = @_;
1393 0 return [$name, {'_xml' => 1}, $value];
1394 }
1395  
1396 sub typecast {
1397 357 ▶ my $self = shift;
Subroutine typecast: called CC=6 SCAR=17.9
1398 357 my($value, $name, $type, $attr) = @_;
1399 357 ▶ return if ref $value; # skip complex object, caller knows how to deal with it
Branch: 1 branch
BranchTrueFalseTotal
if ref $value 277 80 357
1400 80 ▶ return if $self->autotype && !defined $type; # we don't know, autotype knows
Branch: 1 branch
BranchTrueFalseTotal
if $self->autotype and not defined $type 46 34 80
Condition100%3/3
$self->autotype and not defined $type
!ll&&!rl&&r
23246
MC/DC100%2/2
$self->autotype and not defined $type
$self->autotype not defined $type
Truth table100%3/3
A and not(B)
A= $self->autotypeB= not defined $type
ABresult
0X0
100
111
1401 34 ▶ return [$name,
Branch: 1 branch
BranchTrueFalseTotal
defined $type && $type gt '' ? : 1 33 34
Condition100%3/3
defined $type and $type gt ""
!ll&&!rl&&r
2311
MC/DC100%2/2
defined $type and $type gt ""
defined $type $type gt ""
Truth table100%3/3
A and B
A= defined $typeB= $type gt ""
ABresult
0X0
100
111
1402 {(defined $type && $type gt '' ? ('xsi:type' => $self->maptypetouri($type, 'simple type')) : ()), %$attr},
1403 $value
1404 ];
1405 }
1406  
1407 sub register_ns {
1408 174 ▶ my $self = shift->new();
Subroutine register_ns: called CC=3 SCAR=11.0
1409 174 my ($ns,$prefix) = @_;
1410 174 ▶ $prefix = gen_ns if !$prefix;
Branch: 1 branch
BranchTrueFalseTotal
unless $prefix 9 165 174
1411 174 ▶ $self->{'_namespaces'}->{$ns} = $prefix if $ns;
Branch: 1 branch
BranchTrueFalseTotal
if $ns 156 18 174
1412 }
1413  
1414 sub find_prefix {
1415 6 ▶ my ($self, $ns) = @_;
Subroutine find_prefix: called CC=2 SCAR=6.9
1416 return (exists $self->{'_namespaces'}->{$ns})
1417 6 ▶ ? $self->{'_namespaces'}->{$ns}
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'_namespaces'}{$ns} ? : 4 2 6
1418 : ();
1419 }
1420  
1421 sub fixattrs {
1422 342 ▶ my ($self, $data) = @_;
Subroutine fixattrs: called CC=15 SCAR=28.6
1423 342 my ($name, $attr) = ($data->SOAP::Data::name, {%{$data->SOAP::Data::attr}});
1424 342 my ($xmlns, $prefix) = ($data->uri, $data->prefix);
1425 342 ▶ unless (defined($xmlns) || defined($prefix)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $xmlns or defined $prefix) 205 137 342
Condition100%3/3
defined $xmlns or defined $prefix
l!l&&r!l&&!r
1136205
MC/DC100%2/2
defined $xmlns or defined $prefix
defined $xmlns defined $prefix
Truth table100%3/3
A or B
A= defined $xmlnsB= defined $prefix
ABresult
1X1
011
000
1426 205 ▶ $self->register_ns($xmlns,$prefix) unless ($self->use_default_ns);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->use_default_ns 9 196 205
1427 205 return ($name, $attr);
1428 }
1429 137 ▶ $name ||= gen_name(); # local name
Condition66%2/3
$name ||= gen_name()
l!l&&r!l&&!r
13610
MC/DC0%0/2
$name ||= gen_name()
$name gen_name()
Truth table66%2/3
A ||= B
A= $nameB= gen_name()
ABresult
1X1
011
000
1430 137 ▶ $prefix = gen_ns() if !defined $prefix && $xmlns gt '';
Branch: 1 branch
BranchTrueFalseTotal
if not defined $prefix and $xmlns gt "" 1 136 137
Condition66%2/3
not defined $prefix and $xmlns gt ""
!ll&&!rl&&r
13601
MC/DC50%1/2
not defined $prefix and $xmlns gt ""
not defined $prefix $xmlns gt ""
Truth table66%2/3
not(A) and B
A= not defined $prefixB= $xmlns gt ""
ABresult
0X0
100
111
1431 137 ▶ $prefix = ''
Branch: 1 branch
BranchTrueFalseTotal
if defined $xmlns and $xmlns eq "" or defined $prefix and $prefix eq "" 0 137 137
Condition44%4/9
defined $xmlns and $xmlns eq "" or defined $prefix and $prefix eq ""
l!l&&r!l&&!r
00137
defined $xmlns and $xmlns eq ""
!ll&&!rl&&r
13610
defined $prefix and $prefix eq ""
!ll&&!rl&&r
01370
MC/DC0%0/4
defined $xmlns and $xmlns eq "" or defined $prefix and $prefix eq ""
defined $xmlns $xmlns eq "" defined $prefix $prefix eq ""
Truth table28%2/7
A and B or C and D
A= defined $xmlnsB= $xmlns eq ""C= defined $prefixD= $prefix eq ""
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
1432 if defined $xmlns && $xmlns eq ''
1433 || defined $prefix && $prefix eq '';
1434  
1435 137 ▶ $attr->{join ':', xmlns => $prefix || ()} = $xmlns if defined $xmlns;
Branch: 1 branch
BranchTrueFalseTotal
if defined $xmlns 1 136 137
Condition33%1/3
$prefix || ()
l!l&&r!l&&!r
100
MC/DC0%0/2
$prefix || ()
$prefix ()
Truth table33%1/3
A || B
A= $prefixB= ()
ABresult
1X1
011
000
1436 137 ▶ $name = join ':', $prefix, $name if $prefix;
Branch: 1 branch
BranchTrueFalseTotal
if $prefix 137 0 137
1437  
1438 137 ▶ $self->register_ns($xmlns,$prefix) unless ($self->use_default_ns);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->use_default_ns 9 128 137
1439  
1440 137 return ($name, $attr);
1441  
1442 }
1443  
1444 sub toqname {
1445 59 ▶ my $self = shift;
Subroutine toqname: called CC=3 SCAR=12.0
1446 59 my $long = shift;
1447  
1448 59 ▶ return $long unless $long =~ /^\{(.*)\}(.+)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $long =~ /^\{(.*)\}(.+)$/ 0 59 59
1449 59 ▶ return SOAP::Utils::qualify $self->namespaces->{$1} ||= gen_ns, $2;
Condition33%1/3
$self->namespaces->{$1} ||= gen_ns()
l!l&&r!l&&!r
5900
MC/DC0%0/2
$self->namespaces->{$1} ||= gen_ns()
$self->namespaces->{$1} gen_ns()
Truth table33%1/3
A ||= B
A= $self->namespaces->{$1}B= gen_ns()
ABresult
1X1
011
000
1450 }
1451  
1452 sub attrstoqname {
1453 342 ▶ my $self = shift;
Subroutine attrstoqname: called CC=4 SCAR=14.6
1454 342 my $attrs = shift;
1455  
1456 return {
1457 342 map { /^\{(.*)\}(.+)$/
1458 ? ($self->toqname($_) => $2 eq 'type'
1459 || $2 eq 'arrayType'
1460 ? $self->toqname($attrs->{$_})
1461 : $attrs->{$_})
1462 93 ▶ : ($_ => $attrs->{$_})
Branch: 2 branches
BranchTrueFalseTotal
/^\{(.*)\}(.+)$/ ? : 59 34 93
$2 eq 'type' || $2 eq 'arrayType' ? : 0 59 59
Condition33%1/3
$2 eq "type" or $2 eq "arrayType"
l!l&&r!l&&!r
0059
MC/DC0%0/2
$2 eq "type" or $2 eq "arrayType"
$2 eq "type" $2 eq "arrayType"
Truth table33%1/3
A or B
A= $2 eq "type"B= $2 eq "arrayType"
ABresult
1X1
011
000
1463 } keys %$attrs
1464 };
1465 }
1466  
1467 sub tag {
1468 292 ▶ my ($self, $tag, $attrs, @values) = @_;
Subroutine tag: called CC=18 SCAR=29.2
1469  
1470 292 my $readable = $self->{ _readable };
1471  
1472 292 my $value = join '', @values;
1473 292 ▶ my $indent = $readable ? ' ' x (($self->{ _level }-1)*2) : '';
Branch: 1 branch
BranchTrueFalseTotal
$readable ? : 6 286 292
1474  
1475 # check for special attribute
1476 292 ▶ return "$indent$value" if exists $attrs->{_xml} && delete $attrs->{_xml};
Branch: 1 branch
BranchTrueFalseTotal
if exists $attrs->{"_xml"} and delete $attrs->{"_xml"} 0 292 292
Condition33%1/3
exists $attrs->{"_xml"} and delete $attrs->{"_xml"}
!ll&&!rl&&r
29200
MC/DC0%0/2
exists $attrs->{"_xml"} and delete $attrs->{"_xml"}
exists $attrs->{"_xml"} delete $attrs->{"_xml"}
Truth table33%1/3
A and B
A= exists $attrs->{"_xml"}B= delete $attrs->{"_xml"}
ABresult
0X0
100
111
1477  
1478 292 ▶ die "Element '$tag' can't be allowed in valid XML message. Died."
Branch: 1 branch
BranchTrueFalseTotal
unless $tag =~ /^$SOAP::Constants::NSMASK$/o 1 291 292
1479 if $tag !~ /^$SOAP::Constants::NSMASK$/o;
1480  
1481 291 ▶ warn "Element '$tag' uses the reserved prefix 'XML' (in any case)"
Branch: 1 branch
BranchTrueFalseTotal
unless $tag =~ /^(?![Xx][Mm][Ll])/ 1 290 291
1482 if $tag !~ /^(?![Xx][Mm][Ll])/;
1483  
1484 291 ▶ my $prolog = $readable ? "\n" : "";
Branch: 1 branch
BranchTrueFalseTotal
$readable ? : 6 285 291
1485 291 ▶ my $epilog = $readable ? "\n" : "";
Branch: 1 branch
BranchTrueFalseTotal
$readable ? : 6 285 291
1486 291 my $tagjoiner = " ";
1487 291 ▶ if ($self->{ _level } == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_level"} == 1) 76 215 291
1488 76 my $namespaces = $self->namespaces;
1489 76 foreach (keys %$namespaces) {
1490 295 $attrs->{SOAP::Utils::qualify(xmlns => $namespaces->{$_})} = $_
1491 }
1492 76 ▶ $prolog = qq!<?xml version="1.0" encoding="@{[$self->encoding]}"?>!
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->encoding 76 0 76
1493 if defined $self->encoding;
1494 76 ▶ $prolog .= "\n" if $readable;
Branch: 1 branch
BranchTrueFalseTotal
if $readable 1 75 76
1495 76 ▶ $tagjoiner = " \n".(' ' x 4 ) if $readable;
Branch: 1 branch
BranchTrueFalseTotal
if $readable 1 75 76
1496 }
1497 my $tagattrs = join($tagjoiner, '',
1498 468 map { sprintf '%s="%s"', $_, SOAP::Utils::encode_attribute($attrs->{$_}) }
1499 291 ▶ grep { $_ && defined $attrs->{$_} && ($_ ne 'xsi:type' || $attrs->{$_} ne '') }
Branch: 1 branch
BranchTrueFalseTotal
$_ and defined $attrs->{$_} and $_ ne "xsi:type" || $attrs->{$_} ne "" 468 177 645
Condition66%6/9
$_ && defined $attrs->{$_} && ($_ ne 'xsi:type' || $attrs->{$_} ne '')
!ll&&!rl&&r
1770468
$_ and defined $attrs->{$_}
!ll&&!rl&&r
0177468
$_ ne "xsi:type" or $attrs->{$_} ne ""
l!l&&r!l&&!r
414540
MC/DC25%1/4
$_ && defined $attrs->{$_} && ($_ ne 'xsi:type' || $attrs->{$_} ne '')
$_ defined $attrs->{$_} $_ ne "xsi:type" $attrs->{$_} ne ""
Truth table60%3/5
A and B && C or D
A= $_B= defined $attrs->{$_}C= $_ ne "xsi:type"D= $attrs->{$_} ne ""
ABCDresult
0XXX0
10XX0
11000
111X1
11011
1500 sort keys %$attrs);
1501  
1502 291 ▶ if ($value gt '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($value gt '') { } 264 27 291
1503 264 ▶ return sprintf("$prolog$indent<%s%s>%s%s</%s>$epilog",$tag,$tagattrs,$value,($value =~ /^\s*</ ? $indent : ""),$tag);
Branch: 1 branch
BranchTrueFalseTotal
$value =~ /^\s*</ ? : 181 83 264
1504 }
1505 else {
1506 27 return sprintf("$prolog$indent<%s%s />$epilog$indent",$tag,$tagattrs);
1507 }
1508 }
1509  
1510 sub xmlize {
1511 288 ▶ my $self = shift;
Subroutine xmlize: called CC=7 SCAR=19.5
1512 288 my($name, $attrs, $values, $id) = @{$_[0]};
1513 288 ▶ $attrs ||= {};
Condition50%1/2
$attrs ||= {}
l!l
2880
MC/DC0%0/1
$attrs ||= {}
$attrs
Truth table50%1/2
A
A= $attrs
Aresult
11
00
1514  
1515 288 local $self->{_level} = $self->{_level} + 1;
1516  
1517 288 ▶ return $self->tag($name, $attrs)
Branch: 1 branch
BranchTrueFalseTotal
unless defined $values 16 272 288
1518 unless defined $values;
1519  
1520 272 ▶ return $self->tag($name, $attrs, $values)
Branch: 1 branch
BranchTrueFalseTotal
unless ref $values eq "ARRAY" 85 187 272
1521 unless ref $values eq "ARRAY";
1522  
1523 return $self->tag($name, {%$attrs, href => '#'.$self->multiref_anchor($id)})
1524 187 ▶ if $self->is_href($id, delete($attrs->{_id}));
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_href($id, delete $attrs->{"_id"}) 5 182 187
1525  
1526 # we have seen this element as a reference
1527 182 ▶ if (defined $id && $self->{ _seen }->{ $id }->{ multiref}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $id and $self->{'_seen'}{$id}{'multiref'}) { } 5 177 182
Condition66%2/3
defined $id and $self->{"_seen"}{$id}{"multiref"}
!ll&&!rl&&r
01775
MC/DC50%1/2
defined $id and $self->{"_seen"}{$id}{"multiref"}
defined $id $self->{"_seen"}{$id}{"multiref"}
Truth table66%2/3
A and B
A= defined $idB= $self->{"_seen"}{$id}{"multiref"}
ABresult
0X0
100
111
1528 return $self->tag($name,
1529 {
1530 %$attrs, id => $self->multiref_anchor($id)
1531 },
1532 5 map {$self->xmlize($_)} @$values
1533 );
1534 }
1535 else {
1536 177 return $self->tag($name, $attrs, map {$self->xmlize($_)} @$values);
1537 }
1538 }
1539  
1540 sub uriformethod {
1541 16 ▶ my $self = shift;
Subroutine uriformethod: called CC=14 SCAR=42.2
1542  
1543 16 ▶ my $method_is_data = ref $_[0] && UNIVERSAL::isa($_[0] => 'SOAP::Data');
Condition33%1/3
ref $_[0] && UNIVERSAL::isa($_[0], 'SOAP::Data')
!ll&&!rl&&r
1600
MC/DC0%0/2
ref $_[0] && UNIVERSAL::isa($_[0], 'SOAP::Data')
ref $_[0] UNIVERSAL::isa($_[0], 'SOAP::Data')
Truth table33%1/3
A && B
A= ref $_[0]B= UNIVERSAL::isa($_[0], 'SOAP::Data')
ABresult
0X0
100
111
1544  
1545 # drop prefix from method that could be string or SOAP::Data object
1546 16 ▶ my($prefix, $method) = $method_is_data
Branch: 1 branch
BranchTrueFalseTotal
$method_is_data ? : 0 16 16
1547 ? ($_[0]->prefix, $_[0]->name)
1548 : SOAP::Utils::splitqname($_[0]);
1549  
1550 16 my $attr = {reverse %{$self->namespaces}};
1551 # try to define namespace that could be stored as
1552 # a) method is SOAP::Data
1553 # ? attribute in method's element as xmlns= or xmlns:${prefix}=
1554 # : uri
1555 # b) attribute in Envelope element as xmlns= or xmlns:${prefix}=
1556 # c) no prefix or prefix equal serializer->envprefix
1557 # ? '', but see comment below
1558 # : die with error message
1559 my $uri = $method_is_data
1560 16 ▶ ? ref $_[0]->attr && ($_[0]->attr->{$prefix ? "xmlns:$prefix" : 'xmlns'} || $_[0]->uri)
Branch: 2 branches
BranchTrueFalseTotal
$method_is_data ? : 0 16 16
$prefix ? : 0 0 0
Condition0%0/6
ref $_[0]->attr and $_[0]->attr->{$prefix ? "xmlns:$prefix" : "xmlns"} || $_[0]->uri
!ll&&!rl&&r
000
$_[0]->attr->{$prefix ? "xmlns:$prefix" : "xmlns"} or $_[0]->uri
l!l&&r!l&&!r
000
MC/DC0%0/3
ref $_[0]->attr and $_[0]->attr->{$prefix ? "xmlns:$prefix" : "xmlns"} || $_[0]->uri
ref $_[0]->attr $_[0]->attr->{$prefix ? "xmlns:$prefix" : "xmlns"} $_[0]->uri
Truth table0%0/4
A and B or C
A= ref $_[0]->attrB= $_[0]->attr->{$prefix ? "xmlns:$prefix" : "xmlns"}C= $_[0]->uri
ABCresult
0XX0
1000
11X1
1011
1561 : $self->uri;
1562  
1563 16 ▶ defined $uri or $uri = $attr->{$prefix || ''};
Branch: 1 branch
BranchTrueFalseTotal
defined $uri or $uri = $$attr{$prefix or ""} 0 16 16
Condition0%0/2
$prefix || ''
l!l
00
MC/DC0%0/1
$prefix || ''
$prefix
Truth table0%0/2
A
A= $prefix
Aresult
11
00
1564  
1565 16 ▶ defined $uri or $uri = !$prefix || $prefix eq $self->envprefix
Branch: 3 branches
BranchTrueFalseTotal
defined $uri or $uri = !$prefix || $prefix eq $self->envprefix ? ($method_is_data && $^W && warn("URI is not provided as an attribute for method ($method)\n"), "") : die("Can't find namespace for method (${prefix}:$method)\n") 0 16 16
!$prefix || $prefix eq $self->envprefix ? : 0 0 0
$method_is_data and $^W and warn "URI is not provided as an attribute for method ($method)\n" 0 0 0
Condition0%0/6
not $prefix or $prefix eq $self->envprefix
l!l&&r!l&&!r
000
$method_is_data and $^W
!ll&&!rl&&r
000
MC/DC0%0/2
not $prefix or $prefix eq $self->envprefix
not $prefix $prefix eq $self->envprefix
MC/DC0%0/2
$method_is_data and $^W
$method_is_data $^W
Truth table0%0/3
not(A) or B
A= not $prefixB= $prefix eq $self->envprefix
ABresult
1X1
011
000
Truth table0%0/3
A and B
A= $method_is_dataB= $^W
ABresult
0X0
100
111
1566 # still in doubts what should namespace be in this case
1567 # but will keep it like this for now and be compatible with our server
1568 ? ( $method_is_data
1569 && $^W
1570 && warn("URI is not provided as an attribute for method ($method)\n"),
1571 ''
1572 )
1573 : die "Can't find namespace for method ($prefix:$method)\n";
1574  
1575 16 return ($uri, $method);
1576 }
1577  
1578 18 ▶sub serialize { SOAP::Trace::trace('()');
Subroutine serialize: called CC=3 SCAR=11.0
1579 18 my $self = shift->new;
1580 18 ▶ @_ == 1 or Carp::croak "serialize() method accepts one parameter";
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or Carp::croak("serialize() method accepts one parameter") 0 18 18
1581  
1582 18 $self->seen({}); # reinitialize multiref table
1583 18 my($encoded) = $self->encode_object($_[0]);
1584  
1585 # now encode multirefs if any
1586 # v -------------- subelements of Envelope
1587 17 ▶ push(@{$encoded->[2]}, $self->encode_multirefs) if ref $encoded->[2];
Branch: 1 branch
BranchTrueFalseTotal
if ref $encoded->[2] 11 6 17
1588 17 return $self->xmlize($encoded);
1589 }
1590  
1591 sub envelope {
1592 59 ▶ SOAP::Trace::trace('()');
Subroutine envelope: called CC=32 SCAR=36.9
1593 59 my $self = shift->new;
1594 59 my $type = shift;
1595 59 my(@parameters, @header);
1596 59 for (@_) {
1597 # Find all the SOAP Headers
1598 131 ▶ if (defined($_) && ref($_) && UNIVERSAL::isa($_ => 'SOAP::Header')) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $_ and ref $_ and UNIVERSAL::isa($_, 'SOAP::Header')) { } 0 131 131
elsif (defined $_ and ref $_ and $self->context and $self->context->packager->is_supported_part($_)) { } 0 131 131
Condition83%5/6
defined $_ and ref $_ and UNIVERSAL::isa($_, "SOAP::Header")
!ll&&!rl&&r
12380
defined $_ and ref $_
!ll&&!rl&&r
30938
MC/DC0%0/3
defined $_ and ref $_ and UNIVERSAL::isa($_, "SOAP::Header")
defined $_ ref $_ UNIVERSAL::isa($_, "SOAP::Header")
Truth table75%3/4
A and B and C
A= defined $_B= ref $_C= UNIVERSAL::isa($_, "SOAP::Header")
ABCresult
0XX0
10X0
1100
1111
1599 0 push(@header, $_);
1600 }
1601 # Find all the SOAP Message Parts (attachments)
1602 ▶ elsif (defined($_) && ref($_) && $self->context
Condition88%8/9
defined $_ and ref $_ and $self->context and $self->context->packager->is_supported_part($_)
!ll&&!rl&&r
12830
defined $_ and ref $_ and $self->context
!ll&&!rl&&r
12353
defined $_ and ref $_
!ll&&!rl&&r
30938
MC/DC0%0/4
defined $_ and ref $_ and $self->context and $self->context->packager->is_supported_part($_)
defined $_ ref $_ $self->context $self->context->packager->is_supported_part($_)
Truth table80%4/5
A and B and C and D
A= defined $_B= ref $_C= $self->contextD= $self->context->packager->is_supported_part($_)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1603 && $self->context->packager->is_supported_part($_)
1604 ) {
1605 0 $self->context->packager->push_part($_);
1606 }
1607 # Find all the SOAP Body elements
1608 else {
1609 # proposed resolution for [ 1700326 ] encode_data called incorrectly in envelope
1610 131 push(@parameters, $_);
1611 # push (@parameters, SOAP::Utils::encode_data($_));
1612 }
1613 }
1614 59 ▶ my $header = @header ? SOAP::Data->set_value(@header) : undef;
Branch: 1 branch
BranchTrueFalseTotal
@header ? : 0 59 59
1615 59 my($body,$parameters);
1616 59 ▶ if ($type eq 'method' || $type eq 'response') {
Branch: 4 branches
BranchTrueFalseTotal
if ($type eq 'method' or $type eq 'response') { } 42 17 59
elsif ($type eq 'fault') { } 15 2 17
elsif ($type eq 'freeform') { } 2 0 2
elsif (not defined $type) { } 0 0 0
Condition100%3/3
$type eq "method" or $type eq "response"
l!l&&r!l&&!r
222017
MC/DC100%2/2
$type eq "method" or $type eq "response"
$type eq "method" $type eq "response"
Truth table100%3/3
A or B
A= $type eq "method"B= $type eq "response"
ABresult
1X1
011
000
1617 42 SOAP::Trace::method(@parameters);
1618  
1619 42 my $method = shift(@parameters);
1620 # or die "Unspecified method for SOAP call\n";
1621  
1622 42 ▶ $parameters = @parameters ? SOAP::Data->set_value(@parameters) : undef;
Branch: 1 branch
BranchTrueFalseTotal
@parameters ? : 29 13 42
1623 42 ▶ if (!defined($method)) {}
Branch: 3 branches
BranchTrueFalseTotal
if (not defined $method) { } 0 42 42
elsif (UNIVERSAL::isa($method, 'SOAP::Data')) { } 0 42 42
elsif ($self->use_default_ns) { } 39 3 42
1624 elsif (UNIVERSAL::isa($method => 'SOAP::Data')) {
1625 0 $body = $method;
1626 }
1627 elsif ($self->use_default_ns) {
1628 39 ▶ if ($self->{'_ns_uri'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_ns_uri'}) { } 29 10 39
1629 $body = SOAP::Data->name($method)
1630 29 ->attr({'xmlns' => $self->{'_ns_uri'} } );
1631 }
1632 else {
1633 10 $body = SOAP::Data->name($method);
1634 }
1635 }
1636 else {
1637 # Commented out by Byrne on 1/4/2006 - to address default namespace problems
1638 # $body = SOAP::Data->name($method)->uri($self->{'_ns_uri'});
1639 # $body = $body->prefix($self->{'_ns_prefix'}) if ($self->{'_ns_prefix'});
1640  
1641 # Added by Byrne on 1/4/2006 - to avoid the unnecessary creation of a new
1642 # namespace
1643 # Begin New Code (replaces code commented out above)
1644 3 $body = SOAP::Data->name($method);
1645 3 my $pre = $self->find_prefix($self->{'_ns_uri'});
1646 3 ▶ $body = $body->prefix($pre) if ($self->{'_ns_prefix'});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_ns_prefix"} 3 0 3
1647 # End new code
1648 }
1649  
1650 # This is breaking a unit test right now...
1651 # proposed resolution for [ 1700326 ] encode_data called incorrectly in envelope
1652 # $body->set_value(SOAP::Utils::encode_data($parameters ? \$parameters : ()))
1653 # if $body;
1654 # must call encode_data on nothing to enforce xsi:nil="true" to be set.
1655 42 ▶ $body->set_value($parameters ? \$parameters : SOAP::Utils::encode_data()) if $body;
Branch: 2 branches
BranchTrueFalseTotal
if $body 42 0 42
$parameters ? : 29 13 42
1656 }
1657 elsif ($type eq 'fault') {
1658 15 SOAP::Trace::fault(@parameters);
1659 # -> attr({'xmlns' => ''})
1660 # Parameter order fixed thanks to Tom Fischer
1661 $body = SOAP::Data-> name(SOAP::Utils::qualify($self->envprefix => 'Fault'))
1662 -> value(\SOAP::Data->set_value(
1663 SOAP::Data->name(faultcode => SOAP::Utils::qualify($self->envprefix => $parameters[0]))->type(""),
1664 SOAP::Data->name(faultstring => SOAP::Utils::encode_data($parameters[1]))->type(""),
1665 defined($parameters[3])
1666 ? SOAP::Data->name(faultactor => $parameters[3])->type("")
1667 : (),
1668 defined($parameters[2])
1669 15 ▶ ? SOAP::Data->name(detail => do{
Branch: 2 branches
BranchTrueFalseTotal
defined $parameters[3] ? : 1 14 15
defined $parameters[2] ? : 1 14 15
1670 1 my $detail = $parameters[2];
1671 1 ▶ ref $detail
Branch: 1 branch
BranchTrueFalseTotal
ref $detail ? : 0 1 1
1672 ? \$detail
1673 : SOAP::Utils::encode_data($detail)
1674 })
1675 : (),
1676 ));
1677 }
1678 elsif ($type eq 'freeform') {
1679 2 SOAP::Trace::freeform(@parameters);
1680 2 $body = SOAP::Data->set_value(@parameters);
1681 }
1682 elsif (!defined($type)) {
1683 # This occurs when the Body is intended to be null. When no method has been
1684 # passed in of any kind.
1685 }
1686 else {
1687 0 die "Wrong type of envelope ($type) for SOAP call\n";
1688 }
1689  
1690 59 $self->{ _seen } = {}; # reinitialize multiref table
1691  
1692 # Build the envelope
1693 # Right now it is possible for $body to be a SOAP::Data element that has not
1694 # XML escaped any values. How do you remedy this?
1695 59 ▶ my($encoded) = $self->encode_object(
Branch: 2 branches
BranchTrueFalseTotal
$header ? : 0 59 59
$body ? : 59 0 59
1696 SOAP::Data->name(
1697 SOAP::Utils::qualify($self->envprefix => 'Envelope') => \SOAP::Data->value(
1698 ($header
1699 ? SOAP::Data->name( SOAP::Utils::qualify($self->envprefix => 'Header') => \$header)->attr( $self->headerattr)
1700 : ()
1701 ),
1702 ($body
1703 ? SOAP::Data->name(SOAP::Utils::qualify($self->envprefix => 'Body') => \$body)
1704 : SOAP::Data->name(SOAP::Utils::qualify($self->envprefix => 'Body'))
1705 )->attr( $self->bodyattr),
1706 )
1707 )->attr($self->attr)
1708 );
1709  
1710 59 ▶ $self->signature($parameters->signature) if ref $parameters;
Branch: 1 branch
BranchTrueFalseTotal
if ref $parameters 29 30 59
1711  
1712 # IMHO multirefs should be encoded after Body, but only some
1713 # toolkits understand this encoding, so we'll keep them for now (04/15/2001)
1714 # as the last element inside the Body
1715 # v -------------- subelements of Envelope
1716 # vv -------- last of them (Body)
1717 # v --- subelements
1718 59 ▶ push(@{$encoded->[2]->[-1]->[2]}, $self->encode_multirefs) if ref $encoded->[2]->[-1]->[2];
Branch: 1 branch
BranchTrueFalseTotal
if ref $encoded->[2][-1][2] 59 0 59
1719  
1720 # Sometimes SOAP::Serializer is invoked statically when there is no context.
1721 # So first check to see if a context exists.
1722 # TODO - a context needs to be initialized by a constructor?
1723 59 ▶ if ($self->context && $self->context->packager->parts) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->context and $self->context->packager->parts) 46 13 59
Condition66%2/3
$self->context and $self->context->packager->parts
!ll&&!rl&&r
13046
MC/DC50%1/2
$self->context and $self->context->packager->parts
$self->context $self->context->packager->parts
Truth table66%2/3
A and B
A= $self->contextB= $self->context->packager->parts
ABresult
0X0
100
111
1724 # TODO - this needs to be called! Calling it though wraps the payload twice!
1725 # return $self->context->packager->package($self->xmlize($encoded));
1726 }
1727  
1728 59 return $self->xmlize($encoded);
1729 }
1730  
1731 # ======================================================================
1732  
1733 package SOAP::Parser;
1734  
1735 125 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
1736  
1737 sub xmlparser {
1738 118 ▶ my $self = shift;
Subroutine xmlparser: called CC=5 SCAR=20.3
1739 return eval {
1740 $SOAP::Constants::DO_NOT_USE_XML_PARSER
1741 ? undef
1742 118 ▶ : do {
Branch: 1 branch
BranchTrueFalseTotal
$SOAP::Constants::DO_NOT_USE_XML_PARSER ? : 0 118 118
1743 118 require XML::Parser;
1744 0 XML::Parser->new() }
1745 }
1746 118 ▶ || eval { require XML::Parser::Lite; XML::Parser::Lite->new }
Condition40%2/5
eval { do { $SOAP::Constants::DO_NOT_USE_XML_PARSER ? undef : do { require XML::Parser; 'XML::Parser'->new } } } || eval { do { require XML::Parser::Lite; 'XML::Parser::Lite'->new } } || die("XML::Parser is not @{[$SOAP::Constants::DO_NOT_USE_XML_PARSER ? 'used' : 'available'];} and ", $@)
l!l
1180
eval { do { $SOAP::Constants::DO_NOT_USE_XML_PARSER ? undef : do { require XML::Parser; "XML::Parser"->new } } } or eval { do { require XML::Parser::Lite; "XML::Parser::Lite"->new } }
l!l&&r!l&&!r
01180
MC/DC0%0/2
eval { do { $SOAP::Constants::DO_NOT_USE_XML_PARSER ? undef : do { require XML::Parser; 'XML::Parser'->new } } } || eval { do { require XML::Parser::Lite; 'XML::Parser::Lite'->new } } || die("XML::Parser is not @{[$SOAP::Constants::DO_NOT_USE_XML_PARSER ? 'used' : 'available'];} and ", $@)
eval { do { $SOAP::Constants::DO_NOT_USE_XML_PARSER ? undef : do { require XML::Parser; "XML::Parser"->new } } } eval { do { require XML::Parser::Lite; "XML::Parser::Lite"->new } }
Truth table33%1/3
A or B
A= eval { do { $SOAP::Constants::DO_NOT_USE_XML_PARSER ? undef : do { require XML::Parser; "XML::Parser"->new } } }B= eval { do { require XML::Parser::Lite; "XML::Parser::Lite"->new } }
ABresult
1X1
011
000
1747 0 ▶ || die "XML::Parser is not @{[$SOAP::Constants::DO_NOT_USE_XML_PARSER ? 'used' : 'available']} and ", $@;
Branch: 1 branch
BranchTrueFalseTotal
$SOAP::Constants::DO_NOT_USE_XML_PARSER ? : 0 0 0
1748 }
1749  
1750 sub parser {
1751 408 ▶ my $self = shift->new;
Subroutine parser: called CC=3 SCAR=12.7
1752  
1753 # set the parser if passed
1754 408 ▶ if (my $parser = shift) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $parser = shift()) 0 408 408
1755 0 $self->{'_parser'} = shift;
1756 0 return $self;
1757 }
1758  
1759 # else return the parser or use XML::Parser::Lite
1760 408 ▶ return ($self->{'_parser'} ||= $self->xmlparser);
Condition66%2/3
$self->{"_parser"} ||= $self->xmlparser
l!l&&r!l&&!r
2901180
MC/DC0%0/2
$self->{"_parser"} ||= $self->xmlparser
$self->{"_parser"} $self->xmlparser
Truth table66%2/3
A ||= B
A= $self->{"_parser"}B= $self->xmlparser
ABresult
1X1
011
000
1761 }
1762  
1763 sub new {
1764 539 ▶ my $self = shift;
Subroutine new: called CC=2 SCAR=6.9
1765 539 ▶ return $self if ref $self;
Branch: 1 branch
BranchTrueFalseTotal
if ref $self 408 131 539
1766 131 my $class = $self;
1767 131 SOAP::Trace::objects('()');
1768 131 return bless {_parser => shift}, $class;
1769 }
1770  
1771 135 ▶sub decode { SOAP::Trace::trace('()');
Subroutine decode: called CC=2 SCAR=6.9
1772 135 my $self = shift;
1773  
1774 $self->parser->setHandlers(
1775 122 ▶ Final => sub { shift; $self->final(@_) },
Subroutine __ANON__: called CC=1 SCAR=0.0
1776 600 ▶ Start => sub { shift; $self->start(@_) },
Subroutine __ANON__: called CC=1 SCAR=0.0
1777 591 ▶ End => sub { shift; $self->end(@_) },
Subroutine __ANON__: called CC=1 SCAR=0.0
1778 778 ▶ Char => sub { shift; $self->char(@_) },
Subroutine __ANON__: called CC=1 SCAR=0.0
1779 0 ▶ ExternEnt => sub { shift; die "External entity (pointing to '$_[1]') is not allowed" },
Subroutine __ANON__: not called CC=1 SCAR=6.9
1780 135 );
1781 # my $parsed = $self->parser->parse($_[0]);
1782 # return $parsed;
1783 #
1784 135 my $ret = undef;
1785 135 eval {
1786 135 $ret = $self->parser->parse($_[0]);
1787 };
1788 135 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 13 122 135
1789 13 $self->final; # Clean up in the event of an error
1790 13 die $@; # Pass back the error
1791 }
1792 122 return $ret;
1793 }
1794  
1795 sub final {
1796 135 ▶ my $self = shift;
Subroutine final: called CC=1 SCAR=0.0
1797  
1798 # clean handlers, otherwise SOAP::Parser won't be deleted:
1799 # it refers to XML::Parser which refers to subs from SOAP::Parser
1800 # Thanks to Ryan Adams <iceman@mit.edu>
1801 # and Craig Johnston <craig.johnston@pressplay.com>
1802 # checked by number of tests in t/02-payload.t
1803  
1804 135 undef $self->{_values};
1805 135 $self->parser->setHandlers(
1806 Final => undef,
1807 Start => undef,
1808 End => undef,
1809 Char => undef,
1810 ExternEnt => undef,
1811 );
1812 135 $self->{_done};
1813 }
1814  
1815 600 ▶sub start { push @{shift->{_values}}, [shift, {@_}] }
Subroutine start: called CC=1 SCAR=0.0
1816  
1817 # string concatenation changed to arrays which should improve performance
1818 # for strings with many entity-encoded elements.
1819 # Thanks to Mathieu Longtin <mrdamnfrenchy@yahoo.com>
1820 778 ▶sub char { push @{shift->{_values}->[-1]->[3]}, shift }
Subroutine char: called CC=1 SCAR=0.0
1821  
1822 sub end {
1823 591 ▶ my $self = shift;
Subroutine end: called CC=4 SCAR=13.9
1824 591 my $done = pop @{$self->{_values}};
1825 $done->[2] = defined $done->[3]
1826 591 ▶ ? join('',@{$done->[3]})
Branch: 2 branches
BranchTrueFalseTotal
unless ref $done->[2] 300 291 591
defined $done->[3] ? : 227 73 300
1827 : '' unless ref $done->[2];
1828 591 undef $done->[3];
1829 591 @{$self->{_values}}
1830 469 ? (push @{$self->{_values}->[-1]->[2]}, $done)
1831 591 ▶ : ($self->{_done} = $done);
Branch: 1 branch
BranchTrueFalseTotal
@{$self->{'_values'};} ? : 469 122 591
1832 }
1833  
1834 # ======================================================================
1835  
1836 package SOAP::SOM;
1837  
1838 43 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
1839 43 ▶use SOAP::Lite::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
1840  
1841 sub BEGIN {
1842 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
1843 43 ▶ my %path = (
Subroutine BEGIN: called CC=4 SCAR=13.9
1844 root => '/',
1845 envelope => '/Envelope',
1846 body => '/Envelope/Body',
1847 header => '/Envelope/Header',
1848 headers => '/Envelope/Header/[>0]',
1849 fault => '/Envelope/Body/Fault',
1850 faultcode => '/Envelope/Body/Fault/faultcode',
1851 faultstring => '/Envelope/Body/Fault/faultstring',
1852 faultactor => '/Envelope/Body/Fault/faultactor',
1853 faultdetail => '/Envelope/Body/Fault/detail',
1854 );
1855 43 for my $method (keys %path) {
1856 *$method = sub {
1857 144 ▶ my $self = shift;
Subroutine __ANON__: called CC=3 SCAR=11.0
1858 144 ▶ ref $self or return $path{$method};
Branch: 1 branch
BranchTrueFalseTotal
ref $self or return $path{$method} 55 89 144
1859 89 ▶ Carp::croak "Method '$method' is readonly and doesn't accept any parameters" if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 89 89
1860 89 return $self->valueof($path{$method});
1861 430 };
1862 }
1863 43 my %results = (
1864 method => '/Envelope/Body/[1]',
1865 result => '/Envelope/Body/[1]/[1]',
1866 freeform => '/Envelope/Body/[>0]',
1867 paramsin => '/Envelope/Body/[1]/[>0]',
1868 paramsall => '/Envelope/Body/[1]/[>0]',
1869 paramsout => '/Envelope/Body/[1]/[>1]'
1870 );
1871 43 for my $method (keys %results) {
1872 *$method = sub {
1873 98 ▶ my $self = shift;
Subroutine __ANON__: called CC=4 SCAR=14.2
1874 98 ▶ ref $self or return $results{$method};
Branch: 1 branch
BranchTrueFalseTotal
ref $self or return $results{$method} 52 46 98
1875 46 ▶ Carp::croak "Method '$method' is readonly and doesn't accept any parameters" if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 46 46
1876 46 ▶ defined $self->fault ? return : return $self->valueof($results{$method});
Branch: 1 branch
BranchTrueFalseTotal
defined $self->fault ? : 0 46 46
1877 258 };
1878 }
1879  
1880 43 for my $method (qw(o_child o_value o_lname o_lattr o_qname)) { # import from SOAP::Utils
1881 215 *$method = \&{'SOAP::Utils::'.$method};
1882 }
1883  
1884 43 __PACKAGE__->__mk_accessors('context');
1885  
1886 }
1887  
1888 # use object in boolean context return true/false on last match
1889 # Ex.: $som->match('//Fault') ? 'SOAP call failed' : 'success';
1890 43 ▶use overload fallback => 1, 'bool' => sub { @{shift->{_current}} > 0 };
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
1891  
1892 94 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
1893  
1894 sub new {
1895 94 ▶ my $self = shift;
Subroutine new: called CC=2 SCAR=7.2
1896 94 ▶ my $class = ref($self) || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
0940
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
1897 94 my $content = shift;
1898 94 SOAP::Trace::objects('()');
1899 94 return bless { _content => $content, _current => [$content] } => $class;
1900 }
1901  
1902 sub parts {
1903 0 ▶ my $self = shift;
Subroutine parts: not called CC=2 SCAR=17.9
1904 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
1905 0 $self->context->packager->parts(@_);
1906 0 return $self;
1907 }
1908 else {
1909 0 return $self->context->packager->parts;
1910 }
1911 }
1912  
1913 sub is_multipart {
1914 0 ▶ my $self = shift;
Subroutine is_multipart: not called CC=1 SCAR=6.9
1915 0 return defined($self->parts);
1916 }
1917  
1918 sub current {
1919 0 ▶ my $self = shift;
Subroutine current: not called CC=3 SCAR=24.8
1920 0 ▶ $self->{_current} = [@_], return $self if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
1921 0 ▶ return wantarray ? @{$self->{_current}} : $self->{_current}->[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
1922 }
1923  
1924 sub valueof {
1925 169 ▶ my $self = shift;
Subroutine valueof: called CC=4 SCAR=13.9
1926 169 local $self->{_current} = $self->{_current};
1927 169 ▶ $self->match(shift) if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 169 0 169
1928 return wantarray
1929 31 ▶ ? map {o_value($_)} @{$self->{_current}}
Branch: 1 branch
BranchTrueFalseTotal
@{$self->{'_current'};} ? : 89 60 149
1930 169 ▶ : @{$self->{_current}} ? o_value($self->{_current}->[0]) : undef;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 20 149 169
1931 }
1932  
1933 sub headerof { # SOAP::Header is the same as SOAP::Data, so just rebless it
1934 wantarray
1935 0 ? map { bless $_ => 'SOAP::Header' } shift->dataof(@_)
1936 0 ▶ : do { # header returned by ->dataof can be undef in scalar context
Subroutine headerof: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
1937 0 my $header = shift->dataof(@_);
1938 0 ▶ ref $header ? bless($header => 'SOAP::Header') : undef;
Branch: 1 branch
BranchTrueFalseTotal
ref $header ? : 0 0 0
1939 };
1940 }
1941  
1942 sub dataof {
1943 53 ▶ my $self = shift;
Subroutine dataof: called CC=4 SCAR=14.0
1944 53 local $self->{_current} = $self->{_current};
1945 53 ▶ $self->match(shift) if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 28 25 53
1946 return wantarray
1947 0 ▶ ? map {$self->_as_data($_)} @{$self->{_current}}
Branch: 1 branch
BranchTrueFalseTotal
@{$self->{'_current'};} ? : 26 0 26
1948 26 : @{$self->{_current}}
1949 53 ▶ ? $self->_as_data($self->{_current}->[0])
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 27 26 53
1950 : undef;
1951 }
1952  
1953 sub namespaceuriof {
1954 25 ▶ my $self = shift;
Subroutine namespaceuriof: called CC=4 SCAR=15.9
1955 25 local $self->{_current} = $self->{_current};
1956 25 ▶ $self->match(shift) if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 25 25
1957 return wantarray
1958 0 ▶ ? map {(SOAP::Utils::splitlongname(o_lname($_)))[0]} @{$self->{_current}}
Branch: 1 branch
BranchTrueFalseTotal
@{$self->{'_current'};} ? : 25 0 25
1959 25 ▶ : @{$self->{_current}} ? (SOAP::Utils::splitlongname(o_lname($self->{_current}->[0])))[0] : undef;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 25 25
1960 }
1961  
1962 #sub _as_data {
1963 # my $self = shift;
1964 # my $pointer = shift;
1965 #
1966 # SOAP::Data
1967 # -> new(prefix => '', name => o_qname($pointer), name => o_lname($pointer), attr => o_lattr($pointer))
1968 # -> set_value(o_value($pointer));
1969 #}
1970  
1971 sub _as_data {
1972 69 ▶ my $self = shift;
Subroutine _as_data: called CC=3 SCAR=11.0
1973 69 my $node = shift;
1974  
1975 69 my $data = SOAP::Data->new( prefix => '',
1976 # name => o_qname has side effect: sets namespace !
1977 name => o_qname($node),
1978 name => o_lname($node),
1979 attr => o_lattr($node) );
1980  
1981 69 ▶ if ( defined o_child($node) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined o_child($node)) { } 23 46 69
1982 23 my @children;
1983 23 foreach my $child ( @{ o_child($node) } ) {
1984 43 push( @children, $self->_as_data($child) );
1985 }
1986 23 $data->set_value( \SOAP::Data->value(@children) );
1987 }
1988 else {
1989 46 $data->set_value( o_value($node) );
1990 }
1991  
1992 69 return $data;
1993 }
1994  
1995  
1996 sub match {
1997 277 ▶ my $self = shift;
Subroutine match: called CC=3 SCAR=14.2
1998 277 my $path = shift;
1999 $self->{_current} = [
2000 0 $path =~ s!^/!! || !@{$self->{_current}}
2001 ? $self->_traverse($self->{_content}, 1 => split '/' => $path)
2002 277 ▶ : map {$self->_traverse_tree(o_child($_), split '/' => $path)} @{$self->{_current}}
Branch: 1 branch
BranchTrueFalseTotal
$path =~ s[^/][] || !@{$self->{'_current'};} ? : 277 0 277
Condition33%1/3
$path =~ s[^/][] or not @{$self->{"_current"};}
l!l&&r!l&&!r
27700
MC/DC0%0/2
$path =~ s[^/][] or not @{$self->{"_current"};}
$path =~ s[^/][] not @{$self->{"_current"};}
Truth table33%1/3
A or not(B)
A= $path =~ s[^/][]B= not @{$self->{"_current"};}
ABresult
1X1
011
000
2003 ];
2004 277 return $self;
2005 }
2006  
2007 sub _traverse {
2008 996 ▶ my ($self, $pointer, $itself, $path, @path) = @_;
Subroutine _traverse: called CC=26 SCAR=34.7
2009  
2010 996 ▶ die "Incorrect parameter" unless $itself =~/^\d+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $itself =~ /^\d+$/ 0 996 996
2011  
2012 996 ▶ if ($path && substr($path, 0, 1) eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($path and substr($path, 0, 1) eq "{") 0 996 996
Condition66%2/3
$path and substr($path, 0, 1) eq "{"
!ll&&!rl&&r
2007960
MC/DC0%0/2
$path and substr($path, 0, 1) eq "{"
$path substr($path, 0, 1) eq "{"
Truth table66%2/3
A and B
A= $pathB= substr($path, 0, 1) eq "{"
ABresult
0X0
100
111
2013 0 ▶ $path = join '/', $path, shift @path while @path && $path !~ /}/;
Branch: 1 branch
BranchTrueFalseTotal
@path and not $path =~ /}/ and do { $path = join("/", $path, shift @path) } 0 0 0
Condition0%0/3
@path and not $path =~ /}/
!ll&&!rl&&r
000
MC/DC0%0/2
@path and not $path =~ /}/
@path not $path =~ /}/
Truth table0%0/3
A and not(B)
A= @pathB= not $path =~ /}/
ABresult
0X0
100
111
2014 }
2015  
2016 996 ▶ my($op, $num) = $path =~ /^\[(<=|<|>=|>|=|!=?)?(\d+)\]$/ if defined $path;
Branch: 1 branch
BranchTrueFalseTotal
if defined $path 970 26 996
2017  
2018 996 ▶ return $pointer unless defined $path;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $path 26 970 996
2019  
2020 970 ▶ if (! $op) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $op) { } 935 35 970
elsif ($op eq '=' or $op eq '!') { } 0 35 35
2021 935 $op = '==';
2022 }
2023 ▶ elsif ($op eq '=' || $op eq '!') {
Condition33%1/3
$op eq "=" or $op eq "!"
l!l&&r!l&&!r
0035
MC/DC0%0/2
$op eq "=" or $op eq "!"
$op eq "=" $op eq "!"
Truth table33%1/3
A or B
A= $op eq "="B= $op eq "!"
ABresult
1X1
011
000
2024 0 $op .= '=';
2025 }
2026 970 ▶ my $numok = defined $num && eval "$itself $op $num";
Condition100%3/3
defined $num && eval "$itself $op $num"
!ll&&!rl&&r
8174149
MC/DC100%2/2
defined $num && eval "$itself $op $num"
defined $num eval "$itself $op $num"
Truth table100%3/3
A && B
A= defined $numB= eval "$itself $op $num"
ABresult
0X0
100
111
2027 970 ▶ my $nameok = (o_lname($pointer) || '') =~ /(?:^|\})$path$/ if defined $path; # name can be with namespace
Branch: 1 branch
BranchTrueFalseTotal
if defined $path 970 0 970
Condition50%1/2
o_lname($pointer) || ''
l!l
9700
MC/DC0%0/1
o_lname($pointer) || ''
o_lname($pointer)
Truth table50%1/2
A
A= o_lname($pointer)
Aresult
11
00
2028  
2029 970 my $anynode = $path eq '';
2030 970 ▶ unless ($anynode) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($anynode) 796 174 970
2031 796 ▶ if (@path) {
Branch: 1 branch
BranchTrueFalseTotal
if (@path) { } 422 374 796
2032 422 ▶ return if defined $num && !$numok || !defined $num && !$nameok;
Branch: 1 branch
BranchTrueFalseTotal
if defined $num and not $numok or not defined $num || $nameok 30 392 422
Condition77%7/9
defined $num and not $numok or not defined $num || $nameok
l!l&&r!l&&!r
030392
defined $num and not $numok
!ll&&!rl&&r
376460
defined $num || $nameok
l!l&&r!l&&!r
4634630
MC/DC75%3/4
defined $num and not $numok or not defined $num || $nameok
defined $num not $numok defined $num $nameok
Truth table42%3/7
A and not(B) or not(C || D)
A= defined $numB= not $numokC= defined $numD= $nameok
ABCDresult
11XX1
0X001
10001
0X1X0
0X010
101X0
10010
2033 }
2034 else {
2035 374 ▶ return $pointer if defined $num && $numok || !defined $num && $nameok;
Branch: 1 branch
BranchTrueFalseTotal
if defined $num and $numok or not defined $num and $nameok 172 202 374
Condition100%9/9
defined $num and $numok or not defined $num and $nameok
l!l&&r!l&&!r
10369202
defined $num and $numok
!ll&&!rl&&r
2674103
not defined $num and $nameok
!ll&&!rl&&r
419869
MC/DC50%2/4
defined $num and $numok or not defined $num and $nameok
defined $num $numok not defined $num $nameok
Truth table42%3/7
A and B or not(C) and D
A= defined $numB= $numokC= not defined $numD= $nameok
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
2036 202 return;
2037 }
2038 }
2039  
2040 566 my @walk;
2041 566 ▶ push @walk, $self->_traverse_tree([$pointer], @path) if $anynode;
Branch: 1 branch
BranchTrueFalseTotal
if $anynode 174 392 566
2042 566 ▶ push @walk, $self->_traverse_tree(o_child($pointer), $anynode ? ($path, @path) : @path);
Branch: 1 branch
BranchTrueFalseTotal
$anynode ? : 174 392 566
2043 566 return @walk;
2044 }
2045  
2046 sub _traverse_tree {
2047 740 ▶ my ($self, $pointer, @path) = @_;
Subroutine _traverse_tree: called CC=4 SCAR=13.9
2048  
2049 # can be list of children or value itself. Traverse only children
2050 740 ▶ return unless ref $pointer eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $pointer eq "ARRAY" 76 664 740
2051  
2052 664 my $itself = 1;
2053  
2054 394 grep {defined}
2055 719 map {$self->_traverse($_, $itself++, @path)}
2056 664 grep {!ref o_lattr($_) ||
2057 !exists o_lattr($_)->{"{$SOAP::Constants::NS_ENC}root"} ||
2058 737 ▶ o_lattr($_)->{"{$SOAP::Constants::NS_ENC}root"} ne '0'}
Branch: 1 branch
BranchTrueFalseTotal
not ref o_lattr($_) && exists o_lattr($_)->{"{$SOAP::Constants::NS_ENC}root"} or o_lattr($_)->{"{$SOAP::Constants::NS_ENC}root"} ne 0 18 719 737
Condition66%2/3
ref o_lattr($_) && exists o_lattr($_)->{"{$SOAP::Constants::NS_ENC}root"}
!ll&&!rl&&r
071918
MC/DC50%1/2
ref o_lattr($_) && exists o_lattr($_)->{"{$SOAP::Constants::NS_ENC}root"}
ref o_lattr($_) exists o_lattr($_)->{"{$SOAP::Constants::NS_ENC}root"}
Truth table66%2/3
A && B
A= ref o_lattr($_)B= exists o_lattr($_)->{"{$SOAP::Constants::NS_ENC}root"}
ABresult
0X0
100
111
2059 @$pointer;
2060 }
2061  
2062 # ======================================================================
2063  
2064 package SOAP::Deserializer;
2065  
2066 43 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
2067 43 ▶use SOAP::Lite::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
2068 43 ▶use Class::Inspector;
Subroutine BEGIN: called CC=1 SCAR=0.0
2069 43 ▶use URI::Escape qw{uri_unescape};
Subroutine BEGIN: called CC=1 SCAR=0.0
2070  
2071 43 @ISA = qw(SOAP::Cloneable);
2072  
2073 131 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
2074  
2075 sub BEGIN {
2076 43 ▶ __PACKAGE__->__mk_accessors( qw(ids hrefs parts parser
Subroutine BEGIN: called CC=1 SCAR=0.0
2077 base xmlschemas xmlschema context) );
2078 }
2079  
2080 # Cache (slow) Class::Inspector results
2081 43 my %_class_loaded=();
2082  
2083 sub new {
2084 324 ▶ my $self = shift;
Subroutine new: called CC=2 SCAR=6.9
2085 324 ▶ return $self if ref $self;
Branch: 1 branch
BranchTrueFalseTotal
if ref $self 193 131 324
2086 131 my $class = $self;
2087 131 SOAP::Trace::objects('()');
2088 return bless {
2089 '_ids' => {},
2090 '_hrefs' => {},
2091 '_parser' => SOAP::Parser->new,
2092 '_xmlschemas' => {
2093 $SOAP::Constants::NS_APS => 'SOAP::XMLSchemaApacheSOAP::Deserializer',
2094 # map {
2095 # $_ => $SOAP::Constants::XML_SCHEMAS{$_} . '::Deserializer'
2096 # } keys %SOAP::Constants::XML_SCHEMAS
2097 map {
2098 131 $_ => 'SOAP::Lite::Deserializer::' . $SOAP::Constants::XML_SCHEMA_OF{$_}
2099 } keys %SOAP::Constants::XML_SCHEMA_OF
2100  
2101 },
2102 }, $class;
2103 }
2104  
2105 sub is_xml {
2106 # Added check for envelope delivery. Fairly standard with MMDF and sendmail
2107 # Thanks to Chris Davies <Chris.Davies@ManheimEurope.com>
2108 133 ▶ $_[1] =~ /^\s*</ || $_[1] !~ /^(?:[\w-]+:|From )/;
Subroutine is_xml: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$_[1] =~ /^\s*</ or not $_[1] =~ /^(?:[\w-]+:|From )/ 29 104 133
2109 }
2110  
2111 sub baselocation {
2112 25 ▶ my $self = shift;
Subroutine baselocation: called CC=4 SCAR=13.9
2113 25 my $location = shift;
2114 25 ▶ if ($location) {
Branch: 1 branch
BranchTrueFalseTotal
if ($location) 8 17 25
2115 8 my $uri = URI->new($location);
2116 # make absolute location if relative
2117 8 ▶ $location = $uri->abs($self->base || 'thismessage:/')->as_string unless $uri->scheme;
Branch: 1 branch
BranchTrueFalseTotal
unless $uri->scheme 4 4 8
Condition50%1/2
$self->base || 'thismessage:/'
l!l
04
MC/DC0%0/1
$self->base || 'thismessage:/'
$self->base
Truth table50%1/2
A
A= $self->base
Aresult
11
00
2118 }
2119 25 return $location;
2120 }
2121  
2122 # Returns the envelope and populates SOAP::Packager with parts
2123 sub decode_parts {
2124 17 ▶ my $self = shift;
Subroutine decode_parts: called CC=7 SCAR=19.7
2125 17 my $env = $self->context->packager->unpackage($_[0],$self->context);
2126 17 my $body = $self->parser->decode($env);
2127 # TODO - This shouldn't be here! This is packager specific!
2128 # However this does need to pull out all the cid's
2129 # to populate ids hash with.
2130 17 foreach (@{$self->context->packager->parts}) {
2131 23 my $data = $_->bodyhandle->as_string;
2132 23 my $type = $_->head->mime_attr('Content-Type');
2133 23 my $location = $_->head->mime_attr('Content-Location');
2134 23 my $id = $_->head->mime_attr('Content-Id');
2135 23 $location = $self->baselocation($location);
2136 23 ▶ my $part = lc($type) eq 'text/xml' && !$SOAP::Constants::DO_NOT_PROCESS_XML_IN_MIME
Branch: 1 branch
BranchTrueFalseTotal
lc $type eq 'text/xml' && !$SOAP::Constants::DO_NOT_PROCESS_XML_IN_MIME ? : 2 21 23
Condition66%2/3
lc $type eq "text/xml" and not $SOAP::Constants::DO_NOT_PROCESS_XML_IN_MIME
!ll&&!rl&&r
2102
MC/DC50%1/2
lc $type eq "text/xml" and not $SOAP::Constants::DO_NOT_PROCESS_XML_IN_MIME
lc $type eq "text/xml" not $SOAP::Constants::DO_NOT_PROCESS_XML_IN_MIME
Truth table66%2/3
A and not(B)
A= lc $type eq "text/xml"B= not $SOAP::Constants::DO_NOT_PROCESS_XML_IN_MIME
ABresult
0X0
100
111
2137 ? $self->parser->decode($data)
2138 : ['mimepart', {}, $data];
2139 # This below looks like unnecessary bloat!!!
2140 # I should probably dereference the mimepart, provide a callback to get the string data
2141 23 ▶ $self->ids->{$1} = $part if ($id && $id =~ m/^<([^>]+)>$/); # strip any leading and trailing brackets
Branch: 1 branch
BranchTrueFalseTotal
if $id and $id =~ /^<([^>]+)>$/ 23 0 23
Condition33%1/3
$id and $id =~ /^<([^>]+)>$/
!ll&&!rl&&r
0023
MC/DC0%0/2
$id and $id =~ /^<([^>]+)>$/
$id $id =~ /^<([^>]+)>$/
Truth table33%1/3
A and B
A= $idB= $id =~ /^<([^>]+)>$/
ABresult
0X0
100
111
2142 23 ▶ $self->ids->{$location} = $part if $location;
Branch: 1 branch
BranchTrueFalseTotal
if $location 6 17 23
2143 }
2144 17 return $body;
2145 }
2146  
2147 # decode returns a parsed body in the form of an ARRAY
2148 # each element of the ARRAY is a HASH, ARRAY or SCALAR
2149 sub decode {
2150 133 ▶ my $self = shift->new; # this actually is important
Subroutine decode: called CC=2 SCAR=6.9
2151 133 ▶ return $self->is_xml($_[0])
Branch: 1 branch
BranchTrueFalseTotal
$self->is_xml($_[0]) ? : 116 17 133
2152 ? $self->parser->decode($_[0])
2153 : $self->decode_parts($_[0]);
2154 }
2155  
2156 # deserialize returns a SOAP::SOM object and parses straight
2157 # text as input
2158 sub deserialize {
2159 133 ▶ SOAP::Trace::trace('()');
Subroutine deserialize: called CC=2 SCAR=6.9
2160 133 my $self = shift->new;
2161  
2162 # initialize
2163 133 $self->hrefs({});
2164 133 $self->ids({});
2165  
2166 # If the document is XML, then ids will be empty
2167 # If the document is MIME, then ids will hold a list of cids
2168 133 my $parsed = $self->decode($_[0]);
2169  
2170 # Having this code here makes multirefs in the Body work, but multirefs
2171 # that reference XML fragments in a MIME part do not work.
2172 120 ▶ if (keys %{$self->ids()}) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %{$self->ids;}) { } 13 107 120
2173 13 $self->traverse_ids($parsed);
2174 }
2175 else {
2176 # delay - set ids to be traversed later in decode_object, they only get
2177 # traversed if an href is found that is referencing an id.
2178 107 $self->ids($parsed);
2179 }
2180 120 $self->decode_object($parsed);
2181 94 my $som = SOAP::SOM->new($parsed);
2182 94 $som->context($self->context); # TODO - try removing this and see if it works!
2183 94 return $som;
2184 }
2185  
2186 sub traverse_ids {
2187 98 ▶ my $self = shift;
Subroutine traverse_ids: called CC=4 SCAR=13.9
2188 98 my $ref = shift;
2189 98 my($undef, $attrs, $children) = @$ref;
2190 # ^^^^^^ to fix nasty error on Mac platform (Carl K. Cunningham)
2191 98 ▶ $self->ids->{$attrs->{'id'}} = $ref if exists $attrs->{'id'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $attrs->{"id"} 21 77 98
2192 98 ▶ return unless ref $children;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $children 43 55 98
2193 55 for (@$children) {
2194 83 $self->traverse_ids($_)
2195 };
2196 }
2197  
2198 43 ▶use constant _ATTRS => 6;
Subroutine BEGIN: called CC=1 SCAR=0.0
2199 43 ▶use constant _NAME => 5;
Subroutine BEGIN: called CC=1 SCAR=0.0
2200  
2201 sub decode_object {
2202 613 ▶ my $self = shift;
Subroutine decode_object: called CC=16 SCAR=28.6
2203 613 my $ref = shift;
2204 613 my($name, $attrs_ref, $children, $value) = @$ref;
2205  
2206 613 my %attrs = %{ $attrs_ref };
2207  
2208 613 $ref->[ _ATTRS ] = \%attrs; # make a copy for long attributes
2209  
2210 43 ▶ use vars qw(%uris);
Subroutine BEGIN: called CC=1 SCAR=0.0
2211 local %uris = (%uris, map {
2212 390 do { (my $ns = $_) =~ s/^xmlns:?//; $ns } => delete $attrs{$_}
2213 613 } grep {/^xmlns(:|$)/} keys %attrs);
2214  
2215 613 foreach (keys %attrs) {
2216 358 ▶ next unless m/^($SOAP::Constants::NSMASK?):($SOAP::Constants::NSMASK)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless /^($SOAP::Constants::NSMASK?):($SOAP::Constants::NSMASK)$/ 151 207 358
2217  
2218 $1 =~ /^[xX][mM][lL]/ ||
2219 $uris{$1} &&
2220 207 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$1 =~ /^[xX][mM][lL]/ or $SOAP::Deserializer::uris{$1} and do { $attrs{SOAP::Utils::longname($SOAP::Deserializer::uris{$1}, $2)} = do { my $value = $attrs{$_}; $2 ne "type" && $2 ne "arrayType" ? $value : SOAP::Utils::longname($value =~ /^($SOAP::Constants::NSMASK?):($SOAP::Constants::NSMASK(?:\[[\d,]*\])*)/ ? ($SOAP::Deserializer::uris{$1} || die("Unresolved prefix '$1' for attribute value '${value}'\n"), $2) : ($SOAP::Deserializer::uris{""} || die("Unspecified namespace for type '${value}'\n"), $value)) }; 1 } or die "Unresolved prefix '$1' for attribute '${_}'\n" 0 207 207
Condition33%2/6
$1 =~ /^[xX][mM][lL]/ or $SOAP::Deserializer::uris{$1} and do { $attrs{SOAP::Utils::longname($SOAP::Deserializer::uris{$1}, $2)} = do { my $value = $attrs{$_}; $2 ne "type" && $2 ne "arrayType" ? $value : SOAP::Utils::longname($value =~ /^($SOAP::Constants::NSMASK?):($SOAP::Constants::NSMASK(?:\[[\d,]*\])*)/ ? ($SOAP::Deserializer::uris{$1} || die("Unresolved prefix '$1' for attribute value '${value}'\n"), $2) : ($SOAP::Deserializer::uris{""} || die("Unspecified namespace for type '${value}'\n"), $value)) }; 1 }
l!l&&r!l&&!r
02070
$SOAP::Deserializer::uris{$1} and do { $attrs{SOAP::Utils::longname($SOAP::Deserializer::uris{$1}, $2)} = do { my $value = $attrs{$_}; $2 ne "type" && $2 ne "arrayType" ? $value : SOAP::Utils::longname($value =~ /^($SOAP::Constants::NSMASK?):($SOAP::Constants::NSMASK(?:\[[\d,]*\])*)/ ? ($SOAP::Deserializer::uris{$1} || die("Unresolved prefix '$1' for attribute value '${value}'\n"), $2) : ($SOAP::Deserializer::uris{""} || die("Unspecified namespace for type '${value}'\n"), $value)) }; 1 }
!ll&&!rl&&r
00207
MC/DC0%0/3
$1 =~ /^[xX][mM][lL]/ or $SOAP::Deserializer::uris{$1} and do { $attrs{SOAP::Utils::longname($SOAP::Deserializer::uris{$1}, $2)} = do { my $value = $attrs{$_}; $2 ne "type" && $2 ne "arrayType" ? $value : SOAP::Utils::longname($value =~ /^($SOAP::Constants::NSMASK?):($SOAP::Constants::NSMASK(?:\[[\d,]*\])*)/ ? ($SOAP::Deserializer::uris{$1} || die("Unresolved prefix '$1' for attribute value '${value}'\n"), $2) : ($SOAP::Deserializer::uris{""} || die("Unspecified namespace for type '${value}'\n"), $value)) }; 1 }
$1 =~ /^[xX][mM][lL]/ $SOAP::Deserializer::uris{$1} do { $attrs{SOAP::Utils::longname($SOAP::Deserializer::uris{$1}, $2)} = do { my $value = $attrs{$_}; $2 ne "type" && $2 ne "arrayType" ? $value : SOAP::Utils::longname($value =~ /^($SOAP::Constants::NSMASK?):($SOAP::Constants::NSMASK(?:\[[\d,]*\])*)/ ? ($SOAP::Deserializer::uris{$1} || die("Unresolved prefix '$1' for attribute value '${value}'\n"), $2) : ($SOAP::Deserializer::uris{""} || die("Unspecified namespace for type '${value}'\n"), $value)) }; 1 }
Truth table25%1/4
A or B and C
A= $1 =~ /^[xX][mM][lL]/B= $SOAP::Deserializer::uris{$1}C= do { $attrs{SOAP::Utils::longname($SOAP::Deserializer::uris{$1}, $2)} = do { my $value = $attrs{$_}; $2 ne "type" && $2 ne "arrayType" ? $value : SOAP::Utils::longname($value =~ /^($SOAP::Constants::NSMASK?):($SOAP::Constants::NSMASK(?:\[[\d,]*\])*)/ ? ($SOAP::Deserializer::uris{$1} || die("Unresolved prefix '$1' for attribute value '${value}'\n"), $2) : ($SOAP::Deserializer::uris{""} || die("Unspecified namespace for type '${value}'\n"), $value)) }; 1 }
ABCresult
1XX1
0111
00X0
0100
2221 207 $attrs{SOAP::Utils::longname($uris{$1}, $2)} = do {
2222 207 my $value = $attrs{$_};
2223 $2 ne 'type' && $2 ne 'arrayType'
2224 ? $value
2225 : SOAP::Utils::longname($value =~ m/^($SOAP::Constants::NSMASK?):(${SOAP::Constants::NSMASK}(?:\[[\d,]*\])*)/
2226 ? ($uris{$1} || die("Unresolved prefix '$1' for attribute value '$value'\n"), $2)
2227 207 ▶ : ($uris{''} || die("Unspecified namespace for type '$value'\n"), $value)
Branch: 2 branches
BranchTrueFalseTotal
$2 ne 'type' && $2 ne 'arrayType' ? : 73 134 207
$value =~ /^($SOAP::Constants::NSMASK?):($SOAP::Constants::NSMASK(?:\[[\d,]*\])*)/ ? : 134 0 134
Condition57%4/7
$2 ne "type" and $2 ne "arrayType"
!ll&&!rl&&r
132273
$SOAP::Deserializer::uris{$1} or die "Unresolved prefix '$1' for attribute value '${value}'\n"
l!l
1340
$SOAP::Deserializer::uris{""} or die "Unspecified namespace for type '${value}'\n"
l!l
00
MC/DC100%2/2
$2 ne "type" and $2 ne "arrayType"
$2 ne "type" $2 ne "arrayType"
MC/DC0%0/1
$SOAP::Deserializer::uris{$1} or die "Unresolved prefix '$1' for attribute value '${value}'\n"
$SOAP::Deserializer::uris{$1}
MC/DC0%0/1
$SOAP::Deserializer::uris{""} or die "Unspecified namespace for type '${value}'\n"
$SOAP::Deserializer::uris{""}
Truth table100%3/3
A and B
A= $2 ne "type"B= $2 ne "arrayType"
ABresult
0X0
100
111
Truth table50%1/2
A
A= $SOAP::Deserializer::uris{$1}
Aresult
11
00
Truth table0%0/2
A
A= $SOAP::Deserializer::uris{""}
Aresult
11
00
2228 );
2229 };
2230 207 1;
2231 }
2232 || die "Unresolved prefix '$1' for attribute '$_'\n";
2233 }
2234  
2235 # and now check the element
2236 613 ▶ my $ns = ($name =~ s/^($SOAP::Constants::NSMASK?):// ? $1 : '');
Branch: 1 branch
BranchTrueFalseTotal
$name =~ s/^($SOAP::Constants::NSMASK?):// ? : 211 402 613
2237 $ref->[ _NAME ] = SOAP::Utils::longname(
2238 $ns
2239 ? ($uris{$ns} || die "Unresolved prefix '$ns' for element '$name'\n")
2240 613 ▶ : (defined $uris{''} ? $uris{''} : undef),
Branch: 2 branches
BranchTrueFalseTotal
$ns ? : 211 402 613
defined $SOAP::Deserializer::uris{''} ? : 72 330 402
Condition50%1/2
$SOAP::Deserializer::uris{$ns} or die "Unresolved prefix '${ns}' for element '${name}'\n"
l!l
2110
MC/DC0%0/1
$SOAP::Deserializer::uris{$ns} or die "Unresolved prefix '${ns}' for element '${name}'\n"
$SOAP::Deserializer::uris{$ns}
Truth table50%1/2
A
A= $SOAP::Deserializer::uris{$ns}
Aresult
11
00
2241 $name
2242 );
2243  
2244 613 ▶ ($children, $value) = (undef, $children) unless ref $children;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $children 312 301 613
2245  
2246 613 return $name => ($ref->[4] = $self->decode_value(
2247 [$ref->[ _NAME ], \%attrs, $children, $value]
2248 ));
2249 }
2250  
2251 sub decode_value {
2252 424 ▶ my $self = shift;
Subroutine decode_value: called CC=78 SCAR=48.1
2253 424 my($name, $attrs, $children, $value) = @{ $_[0] };
2254  
2255 # check SOAP version if applicable
2256 43 ▶ use vars '$level'; local $level = $level || 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
Condition100%2/2
$SOAP::Deserializer::level || 0
l!l
306118
MC/DC100%1/1
$SOAP::Deserializer::level || 0
$SOAP::Deserializer::level
Truth table100%2/2
A
A= $SOAP::Deserializer::level
Aresult
11
00
2257 424 ▶ if (++$level == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$SOAP::Deserializer::level == 1) 118 306 424
2258 118 my($namespace, $envelope) = SOAP::Utils::splitlongname($name);
2259 118 ▶ SOAP::Lite->soapversion($namespace) if $envelope eq 'Envelope' && $namespace;
Branch: 1 branch
BranchTrueFalseTotal
if $envelope eq "Envelope" and $namespace 63 55 118
Condition100%3/3
$envelope eq "Envelope" and $namespace
!ll&&!rl&&r
52363
MC/DC100%2/2
$envelope eq "Envelope" and $namespace
$envelope eq "Envelope" $namespace
Truth table100%3/3
A and B
A= $envelope eq "Envelope"B= $namespace
ABresult
0X0
100
111
2260 }
2261  
2262 424 ▶ if (exists $attrs->{"{$SOAP::Constants::NS_ENV}encodingStyle"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $$attrs{"{$SOAP::Constants::NS_ENV}encodingStyle"}) 52 372 424
2263 # check encodingStyle
2264 # future versions may bind deserializer to encodingStyle
2265 52 my $encodingStyle = $attrs->{"{$SOAP::Constants::NS_ENV}encodingStyle"};
2266 # TODO - SOAP 1.2 and 1.1 have different rules about valid encodingStyle values
2267 # For example, in 1.1 - any http://schemas.xmlsoap.org/soap/encoding/*
2268 # value is valid
2269 52 ▶ if (defined $encodingStyle && length($encodingStyle)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $encodingStyle and length $encodingStyle) 52 0 52
Condition33%1/3
defined $encodingStyle and length $encodingStyle
!ll&&!rl&&r
0052
MC/DC0%0/2
defined $encodingStyle and length $encodingStyle
defined $encodingStyle length $encodingStyle
Truth table33%1/3
A and B
A= defined $encodingStyleB= length $encodingStyle
ABresult
0X0
100
111
2270 52 my %styles = map { $_ => undef } @SOAP::Constants::SUPPORTED_ENCODING_STYLES;
2271 52 my $found = 0;
2272 52 foreach my $e (split(/ +/,$encodingStyle)) {
2273 52 ▶ if (exists $styles{$e}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $styles{$e}) 52 0 52
2274 52 $found ++;
2275 }
2276 }
2277 52 ▶ die "Unrecognized/unsupported value of encodingStyle attribute '$encodingStyle'"
Branch: 1 branch
BranchTrueFalseTotal
unless $found or "SOAP::Lite"->soapversion == "1.1" and $encodingStyle =~ /(?:^|\b)$SOAP::Constants::NS_ENC/ 0 52 52
Condition16%1/6
$found or "SOAP::Lite"->soapversion == "1.1" and $encodingStyle =~ /(?:^|\b)$SOAP::Constants::NS_ENC/
l!l&&r!l&&!r
5200
"SOAP::Lite"->soapversion == "1.1" and $encodingStyle =~ /(?:^|\b)$SOAP::Constants::NS_ENC/
!ll&&!rl&&r
000
MC/DC0%0/3
$found or "SOAP::Lite"->soapversion == "1.1" and $encodingStyle =~ /(?:^|\b)$SOAP::Constants::NS_ENC/
$found "SOAP::Lite"->soapversion == "1.1" $encodingStyle =~ /(?:^|\b)$SOAP::Constants::NS_ENC/
Truth table25%1/4
A or B and C
A= $foundB= "SOAP::Lite"->soapversion == "1.1"C= $encodingStyle =~ /(?:^|\b)$SOAP::Constants::NS_ENC/
ABCresult
1XX1
0111
00X0
0100
2278 if (! $found) && !(SOAP::Lite->soapversion == 1.1 && $encodingStyle =~ /(?:^|\b)$SOAP::Constants::NS_ENC/);
2279 }
2280 }
2281 43 ▶ use vars '$arraytype'; # type of Array element specified on Array itself
Subroutine BEGIN: called CC=1 SCAR=0.0
2282 # either specified with xsi:type, or <enc:name/> or array element
2283 556 my ($type) = grep { defined }
2284 424 ▶ map($attrs->{$_}, sort grep {/^\{$SOAP::Constants::NS_XSI_ALL\}type$/o} keys %$attrs),
Branch: 1 branch
BranchTrueFalseTotal
$name =~ /^\{$SOAP::Constants::NS_ENC\}/ ? : 1 423 424
2285 $name =~ /^\{$SOAP::Constants::NS_ENC\}/ ? $name : $arraytype;
2286 424 local $arraytype; # it's used only for one level, we don't need it anymore
2287  
2288 # $name is not used here since type should be encoded as type, not as name
2289 424 ▶ my ($schema, $class) = SOAP::Utils::splitlongname($type) if $type;
Branch: 1 branch
BranchTrueFalseTotal
if $type 133 291 424
2290 424 ▶ my $schemaclass = defined($schema) && $self->{ _xmlschemas }->{$schema}
Condition83%5/6
defined $schema && $self->{'_xmlschemas'}{$schema} || $self
l!l&&r!l&&!r
1173070
defined $schema and $self->{"_xmlschemas"}{$schema}
!ll&&!rl&&r
29116117
MC/DC0%0/3
defined $schema && $self->{'_xmlschemas'}{$schema} || $self
defined $schema $self->{"_xmlschemas"}{$schema} $self
Truth table60%3/5
A and B || C
A= defined $schemaB= $self->{"_xmlschemas"}{$schema}C= $self
ABCresult
11X1
0X11
1011
0X00
1000
2291 || $self;
2292  
2293 424 ▶ if (! exists $_class_loaded{$schemaclass}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $_class_loaded{$schemaclass}) 70 354 424
2294 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
2295 70 ▶ if (! Class::Inspector->loaded($schemaclass) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("Class::Inspector"->loaded($schemaclass)) 66 4 70
2296 66 ▶ eval "require $schemaclass" or die $@ if not ref $schemaclass;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $schemaclass 9 57 66
Condition60%3/5
ref $schemaclass || (eval "require $schemaclass" || die($@))
l!l
5790
eval "require $schemaclass" or die $@
l!l
90
MC/DC0%0/2
ref $schemaclass || (eval "require $schemaclass" || die($@))
ref $schemaclass eval "require $schemaclass"
Truth table66%2/3
A || B
A= ref $schemaclassB= eval "require $schemaclass"
ABresult
1X1
011
000
2297 }
2298 70 $_class_loaded{$schemaclass} = undef;
2299 }
2300  
2301 # store schema that is used in parsed message
2302 424 ▶ $self->{ _xmlschema } = $schema if ($schema) && $schema =~ /XMLSchema/;
Branch: 1 branch
BranchTrueFalseTotal
if $schema and $schema =~ /XMLSchema/ 109 315 424
Condition100%3/3
$schema and $schema =~ /XMLSchema/
!ll&&!rl&&r
29124109
MC/DC100%2/2
$schema and $schema =~ /XMLSchema/
$schema $schema =~ /XMLSchema/
Truth table100%3/3
A and B
A= $schemaB= $schema =~ /XMLSchema/
ABresult
0X0
100
111
2303  
2304 # don't use class/type if anyType/ur-type is specified on wire
2305 424 ▶ undef $class
Branch: 1 branch
BranchTrueFalseTotal
if $schemaclass->can("anyTypeValue") and $schemaclass->anyTypeValue eq $class 2 422 424
Condition100%3/3
$schemaclass->can("anyTypeValue") and $schemaclass->anyTypeValue eq $class
!ll&&!rl&&r
3131092
MC/DC100%2/2
$schemaclass->can("anyTypeValue") and $schemaclass->anyTypeValue eq $class
$schemaclass->can("anyTypeValue") $schemaclass->anyTypeValue eq $class
Truth table100%3/3
A and B
A= $schemaclass->can("anyTypeValue")B= $schemaclass->anyTypeValue eq $class
ABresult
0X0
100
111
2306 if $schemaclass->can('anyTypeValue')
2307 && $schemaclass->anyTypeValue eq $class;
2308  
2309 424 ▶ my $method = 'as_' . ($class || '-'); # dummy type if not defined
Condition100%2/2
$class || '-'
l!l
131293
MC/DC100%1/1
$class || '-'
$class
Truth table100%2/2
A
A= $class
Aresult
11
00
2310 424 ▶ $class =~ s/__|\./::/g if $class;
Branch: 1 branch
BranchTrueFalseTotal
if $class 131 293 424
2311  
2312 424 my $id = $attrs->{id};
2313 424 ▶ if (defined $id && exists $self->hrefs->{$id}) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $id and exists $self->hrefs->{$id}) { } 10 414 424
elsif (exists $attrs->{'href'}) { } 31 383 414
Condition100%3/3
defined $id and exists $self->hrefs->{$id}
!ll&&!rl&&r
3912310
MC/DC100%2/2
defined $id and exists $self->hrefs->{$id}
defined $id exists $self->hrefs->{$id}
Truth table100%3/3
A and B
A= defined $idB= exists $self->hrefs->{$id}
ABresult
0X0
100
111
2314 10 return $self->hrefs->{$id};
2315 }
2316 elsif (exists $attrs->{href}) {
2317 31 (my $id = delete $attrs->{href}) =~ s/^(#|cid:|uuid:)?//;
2318 31 my $type=$1;
2319 31 ▶ $id=uri_unescape($id) if (defined($type) and $type eq 'cid:');
Branch: 1 branch
BranchTrueFalseTotal
if defined $type and $type eq "cid:" 17 14 31
Condition100%3/3
defined $type and $type eq "cid:"
!ll&&!rl&&r
21217
MC/DC100%2/2
defined $type and $type eq "cid:"
defined $type $type eq "cid:"
Truth table100%3/3
A and B
A= defined $typeB= $type eq "cid:"
ABresult
0X0
100
111
2320 # convert to absolute if not internal '#' or 'cid:'
2321 31 ▶ $id = $self->baselocation($id) unless $type;
Branch: 1 branch
BranchTrueFalseTotal
unless $type 2 29 31
2322 31 ▶ return $self->hrefs->{$id} if exists $self->hrefs->{$id};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->hrefs->{$id} 2 29 31
2323 # First time optimization. we don't traverse IDs unless asked for it.
2324 # This is where traversing id's is delayed from before
2325 # - the first time through - ids should contain a copy of the parsed XML
2326 # structure! seems silly to make so many copies
2327 29 my $ids = $self->ids;
2328 29 ▶ if (ref($ids) ne 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ids ne "HASH") 2 27 29
2329 2 $self->ids({}); # reset list of ids first time through
2330 2 $self->traverse_ids($ids);
2331 }
2332 29 ▶ if (exists($self->ids->{$id})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->ids->{$id}) { } 29 0 29
2333 29 my $obj = ($self->decode_object(delete($self->ids->{$id})))[1];
2334 29 return $self->hrefs->{$id} = $obj;
2335 }
2336 else {
2337 0 die "Unresolved (wrong?) href ($id) in element '$name'\n";
2338 }
2339 }
2340  
2341 return undef if grep {
2342 383 ▶ /^$SOAP::Constants::NS_XSI_NILS$/ && do {
Branch: 2 branches
BranchTrueFalseTotal
if grep {/^$SOAP::Constants::NS_XSI_NILS$/ and do { my $class = $self->xmlschemas->{$1 or $2}; eval "require $class" or die @$; $class->as_undef($attrs->{$_}) };} keys %$attrs 3 380 383
/^$SOAP::Constants::NS_XSI_NILS$/ and do { my $class = $self->xmlschemas->{$1 or $2}; eval "require $class" or die @$; $class->as_undef($attrs->{$_}) } 3 398 401
2343 3 ▶ my $class = $self->xmlschemas->{ $1 || $2 };
Condition66%2/3
$1 || $2
l!l&&r!l&&!r
210
MC/DC0%0/2
$1 || $2
$1 $2
Truth table66%2/3
A || B
A= $1B= $2
ABresult
1X1
011
000
2344 3 ▶ eval "require $class" or die @$;;
Branch: 1 branch
BranchTrueFalseTotal
eval "require $class" or die @$ 0 3 3
2345 3 $class->as_undef($attrs->{$_})
2346 }
2347 } keys %$attrs;
2348  
2349 # try to handle with typecasting
2350 380 my $res = $self->typecast($value, $name, $attrs, $children, $type);
2351 380 ▶ return $res if defined $res;
Branch: 1 branch
BranchTrueFalseTotal
if defined $res 0 380 380
2352  
2353 # ok, continue with others
2354 380 ▶ if (exists $attrs->{"{$SOAP::Constants::NS_ENC}arrayType"}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $$attrs{"{$SOAP::Constants::NS_ENC}arrayType"}) { } 2 378 380
elsif ($name =~ /^\{$SOAP::Constants::NS_ENC\}Struct$/ or not $schemaclass->can($method) and ref $children || defined $class && $value =~ /^\s*$/) { } 211 167 378
2355 2 my $res = [];
2356 2 ▶ $self->hrefs->{$id} = $res if defined $id;
Branch: 1 branch
BranchTrueFalseTotal
if defined $id 0 2 2
2357  
2358 # check for arrayType which could be [1], [,2][5] or []
2359 # [,][1] will NOT be allowed right now (multidimensional sparse array)
2360 2 ▶ my($type, $multisize) = $attrs->{"{$SOAP::Constants::NS_ENC}arrayType"}
Branch: 1 branch
BranchTrueFalseTotal
() = $$attrs{"{$SOAP::Constants::NS_ENC}arrayType"} =~ /^(.+)\[(\d*(?:,\d+)*)\](?:\[(?:\d+(?:,\d+)*)\])*$/ or die qq[Unrecognized/unsupported format of arrayType attribute '@{[$$attrs{"{$SOAP::Constants::NS_ENC}arrayType"}];}'\n] 0 2 2
2361 =~ /^(.+)\[(\d*(?:,\d+)*)\](?:\[(?:\d+(?:,\d+)*)\])*$/
2362 0 or die qq!Unrecognized/unsupported format of arrayType attribute '@{[$attrs->{"{$SOAP::Constants::NS_ENC}arrayType"}]}'\n!;
2363  
2364 2 ▶ my @dimensions = map { $_ || undef } split /,/, $multisize;
Branch: 1 branch
BranchTrueFalseTotal
$_ or undef 0 2 2
2365 2 my $size = 1;
2366 2 ▶ foreach (@dimensions) { $size *= $_ || 0 }
Condition50%1/2
$_ || 0
l!l
20
MC/DC0%0/1
$_ || 0
$_
Truth table50%1/2
A
A= $_
Aresult
11
00
2367  
2368 # TODO ähm, shouldn't this local be my?
2369 2 local $arraytype = $type;
2370  
2371 # multidimensional
2372 2 ▶ if ($multisize =~ /,/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($multisize =~ /,/) { } 0 2 2
2373 @$res = splitarray(
2374 [@dimensions],
2375 0 ▶ [map { scalar(($self->decode_object($_))[1]) } @{$children || []}]
Branch: 1 branch
BranchTrueFalseTotal
$children or [] 0 0 0
2376 );
2377 }
2378 # normal
2379 else {
2380 2 ▶ @$res = map { scalar(($self->decode_object($_))[1]) } @{$children || []};
Branch: 1 branch
BranchTrueFalseTotal
$children or [] 0 2 2
2381 }
2382  
2383 # sparse (position)
2384 2 ▶ if (ref $children && exists SOAP::Utils::o_lattr($children->[0])->{"{$SOAP::Constants::NS_ENC}position"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $children and exists SOAP::Utils::o_lattr($children->[0])->{"{$SOAP::Constants::NS_ENC}position"}) 0 2 2
Condition33%1/3
ref $children and exists SOAP::Utils::o_lattr($children->[0])->{"{$SOAP::Constants::NS_ENC}position"}
!ll&&!rl&&r
020
MC/DC0%0/2
ref $children and exists SOAP::Utils::o_lattr($children->[0])->{"{$SOAP::Constants::NS_ENC}position"}
ref $children exists SOAP::Utils::o_lattr($children->[0])->{"{$SOAP::Constants::NS_ENC}position"}
Truth table33%1/3
A and B
A= ref $childrenB= exists SOAP::Utils::o_lattr($children->[0])->{"{$SOAP::Constants::NS_ENC}position"}
ABresult
0X0
100
111
2385 0 my @new;
2386 0 ▶ for (my $pos = 0; $pos < @$children; $pos++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < @$children) 0 0 0
2387 # TBD implement position in multidimensional array
2388 0 ▶ my($position) = SOAP::Utils::o_lattr($children->[$pos])->{"{$SOAP::Constants::NS_ENC}position"} =~ /^\[(\d+)\]$/
Branch: 1 branch
BranchTrueFalseTotal
my($position) = SOAP::Utils::o_lattr($children->[$pos])->{"{$SOAP::Constants::NS_ENC}position"} =~ /^\[(\d+)\]$/ or die "Position must be specified for all elements of sparse array\n" 0 0 0
2389 or die "Position must be specified for all elements of sparse array\n";
2390 0 $new[$position] = $res->[$pos];
2391 }
2392 0 @$res = @new;
2393 }
2394  
2395 # partially transmitted (offset)
2396 # TBD implement offset in multidimensional array
2397 my($offset) = $attrs->{"{$SOAP::Constants::NS_ENC}offset"} =~ /^\[(\d+)\]$/
2398 2 ▶ if exists $attrs->{"{$SOAP::Constants::NS_ENC}offset"};
Branch: 1 branch
BranchTrueFalseTotal
if exists $$attrs{"{$SOAP::Constants::NS_ENC}offset"} 0 2 2
2399 2 ▶ unshift(@$res, (undef) x $offset) if $offset;
Branch: 1 branch
BranchTrueFalseTotal
if $offset 0 2 2
2400  
2401 2 ▶ die "Too many elements in array. @{[scalar@$res]} instead of claimed $multisize ($size)\n"
Branch: 1 branch
BranchTrueFalseTotal
if $multisize and $size < @$res 0 2 2
Condition33%1/3
$multisize and $size < @$res
!ll&&!rl&&r
020
MC/DC0%0/2
$multisize and $size < @$res
$multisize $size < @$res
Truth table33%1/3
A and B
A= $multisizeB= $size < @$res
ABresult
0X0
100
111
2402 if $multisize && $size < @$res;
2403  
2404 # extend the array if number of elements is specified
2405 2 ▶ $#$res = $dimensions[0]-1 if defined $dimensions[0] && @$res < $dimensions[0];
Branch: 1 branch
BranchTrueFalseTotal
if defined $dimensions[0] and @$res < $dimensions[0] 0 2 2
Condition33%1/3
defined $dimensions[0] and @$res < $dimensions[0]
!ll&&!rl&&r
020
MC/DC0%0/2
defined $dimensions[0] and @$res < $dimensions[0]
defined $dimensions[0] @$res < $dimensions[0]
Truth table33%1/3
A and B
A= defined $dimensions[0]B= @$res < $dimensions[0]
ABresult
0X0
100
111
2406  
2407 2 ▶ return defined $class && $class ne 'Array' ? bless($res => $class) : $res;
Branch: 1 branch
BranchTrueFalseTotal
defined $class && $class ne 'Array' ? : 1 1 2
Condition66%2/3
defined $class and $class ne "Array"
!ll&&!rl&&r
011
MC/DC50%1/2
defined $class and $class ne "Array"
defined $class $class ne "Array"
Truth table66%2/3
A and B
A= defined $classB= $class ne "Array"
ABresult
0X0
100
111
2408  
2409 }
2410 ▶ elsif ($name =~ /^\{$SOAP::Constants::NS_ENC\}Struct$/
Condition91%11/12
$name =~ /^\{$SOAP::Constants::NS_ENC\}Struct$/ or not $schemaclass->can($method) and ref $children || defined $class && $value =~ /^\s*$/
l!l&&r!l&&!r
0211167
not $schemaclass->can($method) and ref $children || defined $class && $value =~ /^\s*$/
!ll&&!rl&&r
8780211
ref $children or defined $class and $value =~ /^\s*$/
l!l&&r!l&&!r
210180
defined $class and $value =~ /^\s*$/
!ll&&!rl&&r
56241
MC/DC80%4/5
$name =~ /^\{$SOAP::Constants::NS_ENC\}Struct$/ or not $schemaclass->can($method) and ref $children || defined $class && $value =~ /^\s*$/
$name =~ /^\{$SOAP::Constants::NS_ENC\}Struct$/ not $schemaclass->can($method) ref $children defined $class $value =~ /^\s*$/
Truth table83%5/6
A or not(B) and C or D and E
A= $name =~ /^\{$SOAP::Constants::NS_ENC\}Struct$/B= not $schemaclass->can($method)C= ref $childrenD= defined $classE= $value =~ /^\s*$/
ABCDEresult
1XXXX1
011XX1
010111
00XXX0
0100X0
010100
2411 || !$schemaclass->can($method)
2412 && (ref $children || defined $class && $value =~ /^\s*$/)) {
2413 211 my $res = {};
2414 211 ▶ $self->hrefs->{$id} = $res if defined $id;
Branch: 1 branch
BranchTrueFalseTotal
if defined $id 20 191 211
2415  
2416 # Patch code introduced in 0.65 - deserializes array properly
2417 # Decode each element of the struct.
2418 211 my %child_count_of = ();
2419 211 ▶ foreach my $child (@{$children || []}) {
Branch: 1 branch
BranchTrueFalseTotal
$children or [] 1 210 211
2420 264 my ($child_name, $child_value) = $self->decode_object($child);
2421 # Store the decoded element in the struct. If the element name is
2422 # repeated, replace the previous scalar value with a new array
2423 # containing both values.
2424 264 ▶ if (not $child_count_of{$child_name}) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $child_count_of{$child_name}) { } 253 11 264
elsif ($child_count_of{$child_name} == 1) { } 4 7 11
2425 # first time to see this value: use scalar
2426 253 $res->{$child_name} = $child_value;
2427 }
2428 elsif ($child_count_of{$child_name} == 1) {
2429 # second time to see this value: convert scalar to array
2430 4 $res->{$child_name} = [ $res->{$child_name}, $child_value ];
2431 }
2432 else {
2433 # already have an array: append to it
2434 7 push @{$res->{$child_name}}, $child_value;
2435 }
2436 264 $child_count_of{$child_name}++;
2437 }
2438 # End patch code
2439  
2440 211 ▶ return defined $class && $class ne 'SOAPStruct' ? bless($res => $class) : $res;
Branch: 1 branch
BranchTrueFalseTotal
defined $class && $class ne 'SOAPStruct' ? : 8 203 211
Condition66%2/3
defined $class and $class ne "SOAPStruct"
!ll&&!rl&&r
20308
MC/DC50%1/2
defined $class and $class ne "SOAPStruct"
defined $class $class ne "SOAPStruct"
Truth table66%2/3
A and B
A= defined $classB= $class ne "SOAPStruct"
ABresult
0X0
100
111
2441 }
2442 else {
2443 167 my $res;
2444 167 ▶ if (my $method_ref = $schemaclass->can($method)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $method_ref = $schemaclass->can($method)) { } 87 80 167
2445 87 $res = $method_ref->($self, $value, $name, $attrs, $children, $type);
2446 }
2447 else {
2448 80 $res = $self->typecast($value, $name, $attrs, $children, $type);
2449 80 ▶ $res = $class ? die "Unrecognized type '$type'\n" : $value
Branch: 2 branches
BranchTrueFalseTotal
unless defined $res 80 0 80
$class ? : 24 56 80
2450 unless defined $res;
2451 }
2452 141 ▶ $self->hrefs->{$id} = $res if defined $id;
Branch: 1 branch
BranchTrueFalseTotal
if defined $id 3 138 141
2453 141 return $res;
2454 }
2455 }
2456  
2457 sub splitarray {
2458 0 ▶ my @sizes = @{+shift};
Subroutine splitarray: not called CC=5 SCAR=34.0
2459 0 my $size = shift @sizes;
2460 0 my $array = shift;
2461  
2462 0 ▶ return splice(@$array, 0, $size) unless @sizes;
Branch: 1 branch
BranchTrueFalseTotal
unless @sizes 0 0 0
2463 0 my @array = ();
2464 0 ▶ push @array, [
Branch: 1 branch
BranchTrueFalseTotal
@$array and !defined($size) || $size-- and do { push @array, [splitarray([@sizes], $array)] } 0 0 0
Condition0%0/6
@$array and !defined($size) || $size--
!ll&&!rl&&r
000
not defined $size or $size--
l!l&&r!l&&!r
000
MC/DC0%0/3
@$array and !defined($size) || $size--
@$array not defined $size $size--
Truth table0%0/4
A and not(B) or C
A= @$arrayB= not defined $sizeC= $size--
ABCresult
0XX0
1000
11X1
1011
2465 splitarray([@sizes], $array)
2466 ] while @$array && (!defined $size || $size--);
2467 0 return @array;
2468 }
2469  
2470 ▶sub typecast { } # typecast is called for both objects AND scalar types
Subroutine typecast: called CC=1 SCAR=0.0
2471 # check ref of the second parameter (first is the object)
2472 # return undef if you don't want to handle it
2473  
2474 # ======================================================================
2475  
2476 package SOAP::Client;
2477  
2478  
2479 43 ▶use SOAP::Lite::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
2480  
2481 43 $VERSION = $SOAP::Lite::VERSION;
2482 sub BEGIN {
2483 43 ▶ __PACKAGE__->__mk_accessors(qw(endpoint code message
Subroutine BEGIN: called CC=1 SCAR=0.0
2484 is_success status options));
2485 }
2486  
2487 # ======================================================================
2488  
2489 package SOAP::Server::Object;
2490  
2491 43 sub gen_id; *gen_id = \&SOAP::Serializer::gen_id;
2492  
2493 43 my %alive;
2494 my %objects;
2495  
2496 sub objects_by_reference {
2497 0 ▶ shift;
Subroutine objects_by_reference: not called CC=3 SCAR=24.8
2498 0 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
2499 @alive{shift()} = ref $_[0]
2500 ? shift
2501 : sub {
2502 0 ▶ $_[1]-$_[$_[5] ? 5 : 4] > $SOAP::Constants::OBJS_BY_REF_KEEPALIVE
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[5] ? : 0 0 0
2503 }
2504 0 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
2505 0 keys %alive;
2506 }
2507  
2508 sub reference {
2509 0 ▶ my $self = shift;
Subroutine reference: not called CC=2 SCAR=17.9
2510 0 my $stamp = time;
2511 0 my $object = shift;
2512 0 my $id = $stamp . $self->gen_id($object);
2513  
2514 # this is code for garbage collection
2515 0 my $time = time;
2516 0 my $type = ref $object;
2517 0 my @objects = grep { $objects{$_}->[1] eq $type } keys %objects;
2518 0 for (grep { $alive{$type}->(scalar @objects, $time, @{$objects{$_}}) } @objects) {
2519 0 delete $objects{$_};
2520 }
2521  
2522 0 $objects{$id} = [$object, $type, $stamp];
2523 0 bless { id => $id } => ref $object;
2524 }
2525  
2526 sub references {
2527 19 ▶ my $self = shift;
Subroutine references: called CC=4 SCAR=23.2
2528 19 ▶ return @_ unless %alive; # small optimization
Branch: 1 branch
BranchTrueFalseTotal
unless %alive 19 0 19
2529 return map {
2530 0 ▶ ref($_) && exists $alive{ref $_}
Branch: 1 branch
BranchTrueFalseTotal
ref $_ && exists $alive{ref $_} ? : 0 0 0
Condition0%0/3
ref $_ and exists $alive{ref $_}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $_ and exists $alive{ref $_}
ref $_ exists $alive{ref $_}
Truth table0%0/3
A and B
A= ref $_B= exists $alive{ref $_}
ABresult
0X0
100
111
2531 ? $self->reference($_)
2532 : $_
2533 } @_;
2534 }
2535  
2536 sub object {
2537 0 ▶ my $self = shift;
Subroutine object: not called CC=6 SCAR=37.4
2538 0 ▶ my $class = ref($self) || $self;
Condition0%0/3
ref $self || $self
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table0%0/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
2539 0 my $object = shift;
2540 0 ▶ return $object unless ref($object) && $alive{ref $object} && exists $object->{id};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $object and $alive{ref $object} and exists $object->{"id"} 0 0 0
Condition0%0/6
ref $object and $alive{ref $object} and exists $object->{"id"}
!ll&&!rl&&r
000
ref $object and $alive{ref $object}
!ll&&!rl&&r
000
MC/DC0%0/3
ref $object and $alive{ref $object} and exists $object->{"id"}
ref $object $alive{ref $object} exists $object->{"id"}
Truth table0%0/4
A and B and C
A= ref $objectB= $alive{ref $object}C= exists $object->{"id"}
ABCresult
0XX0
10X0
1100
1111
2541  
2542 0 my $reference = $objects{$object->{id}};
2543 0 ▶ die "Object with specified id couldn't be found\n" unless ref $reference->[0];
Branch: 1 branch
BranchTrueFalseTotal
unless ref $reference->[0] 0 0 0
2544  
2545 0 $reference->[3] = time; # last access time
2546 0 return $reference->[0]; # reference to actual object
2547 }
2548  
2549 sub objects {
2550 19 ▶ my $self = shift;
Subroutine objects: called CC=5 SCAR=28.4
2551 19 ▶ return @_ unless %alive; # small optimization
Branch: 1 branch
BranchTrueFalseTotal
unless %alive 19 0 19
2552 return map {
2553 0 ref($_) && exists $alive{ref $_} && exists $_->{id}
2554 0 ▶ ? $self->object($_)
Branch: 1 branch
BranchTrueFalseTotal
ref $_ && exists $alive{ref $_} && exists $_->{'id'} ? : 0 0 0
Condition0%0/6
ref $_ and exists $alive{ref $_} and exists $_->{"id"}
!ll&&!rl&&r
000
ref $_ and exists $alive{ref $_}
!ll&&!rl&&r
000
MC/DC0%0/3
ref $_ and exists $alive{ref $_} and exists $_->{"id"}
ref $_ exists $alive{ref $_} exists $_->{"id"}
Truth table0%0/4
A and B and C
A= ref $_B= exists $alive{ref $_}C= exists $_->{"id"}
ABCresult
0XX0
10X0
1100
1111
2555 : $_
2556 } @_;
2557 }
2558  
2559 # ======================================================================
2560  
2561 package SOAP::Server::Parameters;
2562  
2563 sub byNameOrOrder {
2564 0 ▶ unless (UNIVERSAL::isa($_[-1] => 'SOAP::SOM')) {
Subroutine byNameOrOrder: not called CC=5 SCAR=34.0
Branch: 1 branch
BranchTrueFalseTotal
unless (UNIVERSAL::isa($_[-1], "SOAP::SOM")) 0 0 0
2565 0 ▶ warn "Last parameter is expected to be envelope\n" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 0 0
2566 0 pop;
2567 0 return @_;
2568 }
2569 0 my $params = pop->method;
2570 my @mandatory = ref $_[0] eq 'ARRAY'
2571 0 ▶ ? @{shift()}
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'ARRAY' ? : 0 0 0
2572 : die "list of parameters expected as the first parameter for byName";
2573 0 my $byname = 0;
2574 0 my @res = map { $byname += exists $params->{$_}; $params->{$_} } @mandatory;
2575 0 ▶ return $byname
Branch: 1 branch
BranchTrueFalseTotal
$byname ? : 0 0 0
2576 ? @res
2577 : @_;
2578 }
2579  
2580 sub byName {
2581 0 ▶ unless (UNIVERSAL::isa($_[-1] => 'SOAP::SOM')) {
Subroutine byName: not called CC=4 SCAR=30.0
Branch: 1 branch
BranchTrueFalseTotal
unless (UNIVERSAL::isa($_[-1], "SOAP::SOM")) 0 0 0
2582 0 ▶ warn "Last parameter is expected to be envelope\n" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 0 0
2583 0 pop;
2584 0 return @_;
2585 }
2586 0 ▶ return @{pop->method}{ref $_[0] eq 'ARRAY' ? @{shift()} : die "list of parameters expected as the first parameter for byName"};
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'ARRAY' ? : 0 0 0
2587 }
2588  
2589 # ======================================================================
2590  
2591 package SOAP::Server;
2592  
2593 43 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
2594 43 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
2595 20 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
2596  
2597 sub initialize {
2598 return (
2599 packager => SOAP::Packager::MIME->new,
2600 transport => SOAP::Transport->new,
2601 serializer => SOAP::Serializer->new,
2602 deserializer => SOAP::Deserializer->new,
2603 ▶ on_action => sub { ; },
Subroutine __ANON__: called CC=1 SCAR=0.0
2604 on_dispatch => sub {
2605 25 ▶ return;
Subroutine __ANON__: called CC=1 SCAR=0.0
2606 },
2607 25 ▶ );
Subroutine initialize: called CC=1 SCAR=0.0
2608 }
2609  
2610 sub new {
2611 474 ▶ my $self = shift;
Subroutine new: called CC=14 SCAR=31.2
2612 474 ▶ return $self if ref $self;
Branch: 1 branch
BranchTrueFalseTotal
if ref $self 449 25 474
2613  
2614 25 ▶ unless (ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $self) 25 0 25
2615 25 my $class = $self;
2616 25 my(@params, @methods);
2617  
2618 25 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 25 26
2619 1 my($method, $params) = splice(@_,0,2);
2620 1 ▶ $class->can($method)
Branch: 1 branch
BranchTrueFalseTotal
$class->can($method) ? : 1 0 1
Condition0%0/3
$^W and Carp::carp("Unrecognized parameter '${method}' in new()")
!ll&&!rl&&r
000
MC/DC0%0/2
$^W and Carp::carp("Unrecognized parameter '${method}' in new()")
$^W Carp::carp("Unrecognized parameter '${method}' in new()")
Truth table0%0/3
A and B
A= $^WB= Carp::carp("Unrecognized parameter '${method}' in new()")
ABresult
0X0
100
111
2621 ? push(@methods, $method, $params)
2622 : $^W && Carp::carp "Unrecognized parameter '$method' in new()";
2623 }
2624  
2625 25 $self = bless {
2626 _dispatch_to => [],
2627 _dispatch_with => {},
2628 _dispatched => [],
2629 _action => '',
2630 _options => {},
2631 } => $class;
2632 25 unshift(@methods, $self->initialize);
2633 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
2634 25 ▶ while (@methods) {
Branch: 1 branch
BranchTrueFalseTotal
if (@methods) 151 25 176
2635 151 my($method, $params) = splice(@methods,0,2);
2636 151 ▶ $self->$method(ref $params eq 'ARRAY' ? @$params : $params)
Branch: 1 branch
BranchTrueFalseTotal
ref $params eq 'ARRAY' ? : 0 151 151
2637 }
2638 25 SOAP::Trace::objects('()');
2639 }
2640  
2641 25 ▶ Carp::carp "Odd (wrong?) number of parameters in new()"
Branch: 1 branch
BranchTrueFalseTotal
if $^W and @_ & 1 0 25 25
Condition33%1/3
$^W and @_ & 1
!ll&&!rl&&r
2500
MC/DC0%0/2
$^W and @_ & 1
$^W @_ & 1
Truth table33%1/3
A and B
A= $^WB= @_ & 1
ABresult
0X0
100
111
2642 if $^W && (@_ & 1);
2643  
2644 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
2645 25 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 25 25
2646 0 my($method, $params) = splice(@_,0,2);
2647 0 ▶ $self->can($method)
Branch: 2 branches
BranchTrueFalseTotal
$self->can($method) ? : 0 0 0
ref $params eq 'ARRAY' ? : 0 0 0
Condition0%0/3
$^W and Carp::carp("Unrecognized parameter '${method}' in new()")
!ll&&!rl&&r
000
MC/DC0%0/2
$^W and Carp::carp("Unrecognized parameter '${method}' in new()")
$^W Carp::carp("Unrecognized parameter '${method}' in new()")
Truth table0%0/3
A and B
A= $^WB= Carp::carp("Unrecognized parameter '${method}' in new()")
ABresult
0X0
100
111
2648 ? $self->$method(ref $params eq 'ARRAY' ? @$params : $params)
2649 : $^W && Carp::carp "Unrecognized parameter '$method' in new()"
2650 }
2651  
2652 25 return $self;
2653 }
2654  
2655 sub init_context {
2656 30 ▶ my $self = shift;
Subroutine init_context: called CC=1 SCAR=0.0
2657 30 $self->{'_deserializer'}->{'_context'} = $self;
2658 # weaken circular reference to avoid a memory hole
2659 30 weaken($self->{'_deserializer'}->{'_context'});
2660  
2661 30 $self->{'_serializer'}->{'_context'} = $self;
2662 # weaken circular reference to avoid a memory hole
2663 30 weaken($self->{'_serializer'}->{'_context'});
2664 }
2665  
2666 sub BEGIN {
2667 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
2668 43 ▶ for my $method (qw(serializer deserializer transport)) {
Subroutine BEGIN: called CC=5 SCAR=16.1
2669 129 my $field = '_' . $method;
2670 *$method = sub {
2671 261 ▶ my $self = shift->new();
Subroutine __ANON__: called CC=2 SCAR=6.9
2672 261 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 75 186 261
2673 75 my $context = $self->{$field}->{'_context'}; # save the old context
2674 75 $self->{$field} = shift;
2675 75 $self->{$field}->{'_context'} = $context; # restore the old context
2676 75 return $self;
2677 }
2678 else {
2679 186 return $self->{$field};
2680 }
2681 }
2682 129 }
2683  
2684 43 for my $method (qw(action myuri options dispatch_with packager)) {
2685 215 my $field = '_' . $method;
2686 *$method = sub {
2687 177 ▶ my $self = shift->new();
Subroutine __ANON__: called CC=2 SCAR=6.9
2688 (@_)
2689 ? do {
2690 33 $self->{$field} = shift;
2691 33 return $self;
2692 }
2693 177 ▶ : return $self->{$field};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 33 144 177
2694 }
2695 215 }
2696 43 for my $method (qw(on_action on_dispatch)) {
2697 86 my $field = '_' . $method;
2698 *$method = sub {
2699 100 ▶ my $self = shift->new;
Subroutine __ANON__: called CC=4 SCAR=14.0
2700 # my $self = shift;
2701 100 ▶ return $self->{$field} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 50 50 100
2702 50 local $@;
2703 # commented out because that 'eval' was unsecure
2704 # > ref $_[0] eq 'CODE' ? shift : eval shift;
2705 # Am I paranoid enough?
2706 50 $self->{$field} = shift;
2707 50 ▶ Carp::croak $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 50 50
2708 Carp::croak "$method() expects subroutine (CODE) or string that evaluates into subroutine (CODE)"
2709 50 ▶ unless ref $self->{$field} eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self->{$field} eq "CODE" 0 50 50
2710 50 return $self;
2711 }
2712 86 }
2713  
2714 # __PACKAGE__->__mk_accessors( qw(dispatch_to) );
2715 43 for my $method (qw(dispatch_to)) {
2716 43 my $field = '_' . $method;
2717 *$method = sub {
2718 38 ▶ my $self = shift->new;
Subroutine __ANON__: called CC=2 SCAR=6.9
2719 # my $self = shift;
2720 (@_)
2721 ? do {
2722 12 $self->{$field} = [@_];
2723 12 return $self;
2724 }
2725 38 ▶ : return @{ $self->{$field} };
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 12 26 38
2726 }
2727 43 }
2728 }
2729  
2730 sub objects_by_reference {
2731 0 ▶ my $self = shift;
Subroutine objects_by_reference: not called CC=3 SCAR=24.8
2732 0 ▶ $self = $self->new() if not ref $self;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 0 0 0
2733 @_
2734 0 ▶ ? (SOAP::Server::Object->objects_by_reference(@_), return $self)
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
2735 : SOAP::Server::Object->objects_by_reference;
2736 }
2737  
2738 sub dispatched {
2739 1 ▶ my $self = shift;
Subroutine dispatched: called CC=3 SCAR=12.0
2740 1 ▶ $self = $self->new() if not ref $self;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 0 1 1
2741 @_
2742 0 ? (push(@{$self->{_dispatched}}, @_), return $self)
2743 1 ▶ : return @{$self->{_dispatched}};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 1 1
2744 }
2745  
2746 sub find_target {
2747 25 ▶ my $self = shift;
Subroutine find_target: called CC=30 SCAR=36.2
2748 25 my $request = shift;
2749  
2750 # try to find URI/method from on_dispatch call first
2751 25 my($method_uri, $method_name) = $self->on_dispatch->($request);
2752  
2753 # if nothing there, then get it from envelope itself
2754 25 $request->match((ref $request)->method);
2755 25 ▶ ($method_uri, $method_name) = ($request->namespaceuriof || '', $request->dataof->name)
Branch: 1 branch
BranchTrueFalseTotal
unless $method_name 25 0 25
Condition100%2/2
$request->namespaceuriof || ''
l!l
214
MC/DC100%1/1
$request->namespaceuriof || ''
$request->namespaceuriof
Truth table100%2/2
A
A= $request->namespaceuriof
Aresult
11
00
2756 unless $method_name;
2757  
2758 25 $self->on_action->(my $action = $self->action, $method_uri, $method_name);
2759  
2760 # check to avoid security vulnerability: Protected->Unprotected::method(@parameters)
2761 # see for more details: http://www.phrack.org/phrack/58/p58-0x09
2762 25 ▶ die "Denied access to method ($method_name)\n" unless $method_name =~ /^\w+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $method_name =~ /^\w+$/ 0 25 25
2763  
2764 25 my ($class, $static);
2765 # try to bind directly
2766 25 ▶ if (defined($class = $self->dispatch_with->{$method_uri}
Branch: 2 branches
BranchTrueFalseTotal
if (defined($class = $self->dispatch_with->{$method_uri} || $self->dispatch_with->{$action or ''} || (defined $action && $action =~ /^"(.+)"$/ ? $self->dispatch_with->{$1} : undef))) { } 4 21 25
defined $action && $action =~ /^"(.+)"$/ ? : 1 21 22
Condition100%11/11
$self->dispatch_with->{$method_uri} || $self->dispatch_with->{$action or ''} || (defined $action && $action =~ /^"(.+)"$/ ? $self->dispatch_with->{$1} : undef)
l!l&&r!l&&!r
3121
$self->dispatch_with->{$method_uri} or $self->dispatch_with->{$action or ""}
l!l&&r!l&&!r
2122
$action || ''
l!l
221
defined $action and $action =~ /^"(.+)"$/
!ll&&!rl&&r
1201
MC/DC100%4/4
$self->dispatch_with->{$method_uri} || $self->dispatch_with->{$action or ''} || (defined $action && $action =~ /^"(.+)"$/ ? $self->dispatch_with->{$1} : undef)
$self->dispatch_with->{$method_uri} $self->dispatch_with->{$action or ""} defined $action $action =~ /^"(.+)"$/
MC/DC100%1/1
$action || ''
$action
Truth table100%5/5
A or B || C and D
A= $self->dispatch_with->{$method_uri}B= $self->dispatch_with->{$action or ""}C= defined $actionD= $action =~ /^"(.+)"$/
ABCDresult
1XXX1
01XX1
00111
000X0
00100
Truth table100%2/2
A
A= $action
Aresult
11
00
2767 || $self->dispatch_with->{$action || ''}
2768 || (defined($action) && $action =~ /^"(.+)"$/
2769 ? $self->dispatch_with->{$1}
2770 : undef))) {
2771 # return object, nothing else to do here
2772 4 ▶ return ($class, $method_uri, $method_name) if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 1 3 4
2773 3 $static = 1;
2774 }
2775 else {
2776 21 ▶ die "URI path shall map to class" unless defined ($class = URI->new($method_uri)->path);
Branch: 1 branch
BranchTrueFalseTotal
unless defined($class = "URI"->new($method_uri)->path) 0 21 21
2777  
2778 21 for ($class) { s!^/|/$!!g; s!/!::!g; s/^$/main/; }
2779 21 ▶ die "Failed to access class ($class)" unless $class =~ /^(\w[\w:]*)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $class =~ /^(\w[\w:]*)$/ 0 21 21
2780  
2781 21 my $fullname = "$class\::$method_name";
2782 21 foreach ($self->dispatch_to) {
2783 21 ▶ return ($_, $method_uri, $method_name) if ref eq $class; # $OBJECT
Branch: 1 branch
BranchTrueFalseTotal
if ref $_ eq $class 1 20 21
2784 20 ▶ next if ref; # skip other objects
Branch: 1 branch
BranchTrueFalseTotal
if ref $_ 0 20 20
2785 # will ignore errors, because it may complain on
2786 # d:\foo\bar, which is PATH and not regexp
2787 20 eval {
2788 20 ▶ $static ||= $class =~ /^$_$/ # MODULE
Condition50%6/12
$static ||= $class =~ /^$_$/ || $fullname =~ /^$_$/ || $method_name =~ /^$_$/ && $class eq "main"
l!l&&r!l&&!r
0200
$class =~ /^$_$/ || $fullname =~ /^$_$/ || $method_name =~ /^$_$/ && $class eq 'main'
l!l&&r!l&&!r
1810
$class =~ /^$_$/ or $fullname =~ /^$_$/
l!l&&r!l&&!r
1801
$method_name =~ /^$_$/ and $class eq "main"
!ll&&!rl&&r
001
MC/DC0%0/5
$static ||= $class =~ /^$_$/ || $fullname =~ /^$_$/ || $method_name =~ /^$_$/ && $class eq "main"
$static $class =~ /^$_$/ $fullname =~ /^$_$/ $method_name =~ /^$_$/ $class eq "main"
Truth table0%0/6
A ||= B or C || D and E
A= $staticB= $class =~ /^$_$/C= $fullname =~ /^$_$/D= $method_name =~ /^$_$/E= $class eq "main"
ABCDEresult
1XXXX1
01XXX1
001XX1
000111
0000X0
000100
2789 || $fullname =~ /^$_$/ # MODULE::method
2790 || $method_name =~ /^$_$/ && ($class eq 'main'); # method ('main' assumed)
2791 };
2792 }
2793 }
2794  
2795 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
2796  
2797 # TODO - sort this mess out:
2798 # The task is to test whether the class in question has already been loaded.
2799 #
2800 # SOAP::Lite 0.60:
2801 # unless (defined %{"${class}::"}) {
2802 # Patch to SOAP::Lite 0.60:
2803 # The following patch does not work for packages defined within a BEGIN block
2804 # unless (exists($INC{join '/', split /::/, $class.'.pm'})) {
2805 # Combination of 0.60 and patch did not work reliably, either.
2806 #
2807 # Now we do the following: Check whether the class is main (always loaded)
2808 # or the class implements the method in question
2809 # or the package exists as file in %INC.
2810 #
2811 # This is still sort of a hack - but I don't know anything better
2812 # If you have some idea, please help me out...
2813 #
2814 23 ▶ unless (($class eq 'main') || $class->can($method_name)
Branch: 1 branch
BranchTrueFalseTotal
unless ($class eq "main" or $class->can($method_name) or exists $INC{join "/", split(/::/, $class . '.pm', 0)}) 5 18 23
Condition83%5/6
$class eq "main" or $class->can($method_name) or exists $INC{join "/", split(/::/, $class . '.pm', 0)}
l!l&&r!l&&!r
1805
$class eq "main" or $class->can($method_name)
l!l&&r!l&&!r
4145
MC/DC66%2/3
$class eq "main" or $class->can($method_name) or exists $INC{join "/", split(/::/, $class . '.pm', 0)}
$class eq "main" $class->can($method_name) exists $INC{join "/", split(/::/, $class . '.pm', 0)}
Truth table75%3/4
A or B or C
A= $class eq "main"B= $class->can($method_name)C= exists $INC{join "/", split(/::/, $class . '.pm', 0)}
ABCresult
1XX1
01X1
0011
0000
2815 || exists($INC{join '/', split /::/, $class . '.pm'})) {
2816  
2817 # allow all for static and only specified path for dynamic bindings
2818 5 ▶ local @INC = (($static ? @INC : ()), grep {!ref && m![/\\.]!} $self->dispatch_to());
Branch: 2 branches
BranchTrueFalseTotal
$static ? : 5 0 5
not ref $_ and m[[/\\.]] 5 0 5
2819 5 eval 'local $^W; ' . "require $class";
2820 5 ▶ die "Failed to access class ($class): $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 5 0 5
2821 0 ▶ $self->dispatched($class) unless $static;
Branch: 1 branch
BranchTrueFalseTotal
unless $static 0 0 0
2822 }
2823  
2824 die "Denied access to method ($method_name) in class ($class)"
2825 18 ▶ unless $static || grep {/^$class$/} $self->dispatched;
Branch: 1 branch
BranchTrueFalseTotal
unless $static or grep {/^$class$/;} $self->dispatched 1 17 18
Condition66%2/3
$static or grep {/^$class$/;} $self->dispatched
l!l&&r!l&&!r
1701
MC/DC50%1/2
$static or grep {/^$class$/;} $self->dispatched
$static grep {/^$class$/;} $self->dispatched
Truth table66%2/3
A or B
A= $staticB= grep {/^$class$/;} $self->dispatched
ABresult
1X1
011
000
2826  
2827 17 return ($class, $method_uri, $method_name);
2828 }
2829  
2830 sub handle {
2831 30 ▶ SOAP::Trace::trace('()');
Subroutine handle: called CC=26 SCAR=42.1
2832 30 my $self = shift;
2833 30 ▶ $self = $self->new if !ref $self; # inits the server when called in a static context
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 4 26 30
2834 30 $self->init_context();
2835 # we want to restore it when we are done
2836 30 local $SOAP::Constants::DEFAULT_XML_SCHEMA
2837 = $SOAP::Constants::DEFAULT_XML_SCHEMA;
2838  
2839 # SOAP version WILL NOT be restored when we are done.
2840 # is it problem?
2841  
2842 30 my $result = eval {
2843 30 local $SIG{__DIE__};
2844 # why is this here:
2845 30 $self->serializer->soapversion(1.1);
2846 30 my $request = eval { $self->deserializer->deserialize($_[0]) };
2847  
2848 30 ▶ die SOAP::Fault
Branch: 1 branch
BranchTrueFalseTotal
if $@ and $@ =~ /^$SOAP::Constants::WRONG_VERSION/ 0 30 30
Condition66%2/3
$@ and $@ =~ /^$SOAP::Constants::WRONG_VERSION/
!ll&&!rl&&r
2820
MC/DC0%0/2
$@ and $@ =~ /^$SOAP::Constants::WRONG_VERSION/
$@ $@ =~ /^$SOAP::Constants::WRONG_VERSION/
Truth table66%2/3
A and B
A= $@B= $@ =~ /^$SOAP::Constants::WRONG_VERSION/
ABresult
0X0
100
111
2849 ->faultcode($SOAP::Constants::FAULT_VERSION_MISMATCH)
2850 ->faultstring($@)
2851 if $@ && $@ =~ /^$SOAP::Constants::WRONG_VERSION/;
2852  
2853 30 ▶ die "Application failed during request deserialization: $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 2 28 30
2854 28 my $som = ref $request;
2855 28 ▶ die "Can't find root element in the message"
Branch: 1 branch
BranchTrueFalseTotal
unless $request->match($som->envelope) 1 27 28
2856 unless $request->match($som->envelope);
2857 27 $self->serializer->soapversion(SOAP::Lite->soapversion);
2858 27 ▶ $self->serializer->xmlschema($SOAP::Constants::DEFAULT_XML_SCHEMA
Branch: 1 branch
BranchTrueFalseTotal
if $self->deserializer->xmlschema 20 7 27
2859 = $self->deserializer->xmlschema)
2860 if $self->deserializer->xmlschema;
2861  
2862 die SOAP::Fault
2863 ->faultcode($SOAP::Constants::FAULT_MUST_UNDERSTAND)
2864 ->faultstring("Unrecognized header has mustUnderstand attribute set to 'true'")
2865 if !$SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTAND &&
2866 grep {
2867 27 ▶ $_->mustUnderstand
Branch: 2 branches
BranchTrueFalseTotal
if not $SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTAND and grep {$_->mustUnderstand and !$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR;} $request->dataof($som->headers) 0 27 27
$_->mustUnderstand and !$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR 0 0 0
Condition11%1/9
not $SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTAND and grep {$_->mustUnderstand and !$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR;} $request->dataof($som->headers)
!ll&&!rl&&r
0270
$_->mustUnderstand && (!$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR)
!ll&&!rl&&r
000
not $_->actor or $_->actor eq $SOAP::Constants::NEXT_ACTOR
l!l&&r!l&&!r
000
MC/DC0%0/2
not $SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTAND and grep {$_->mustUnderstand and !$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR;} $request->dataof($som->headers)
not $SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTAND grep {$_->mustUnderstand and !$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR;} $request->dataof($som->headers)
MC/DC0%0/3
$_->mustUnderstand && (!$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR)
$_->mustUnderstand not $_->actor $_->actor eq $SOAP::Constants::NEXT_ACTOR
Truth table33%1/3
not(A) and B
A= not $SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTANDB= grep {$_->mustUnderstand and !$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR;} $request->dataof($som->headers)
ABresult
0X0
100
111
Truth table0%0/4
A && not(B) or C
A= $_->mustUnderstandB= not $_->actorC= $_->actor eq $SOAP::Constants::NEXT_ACTOR
ABCresult
0XX0
1000
11X1
1011
2868 && (!$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR)
2869 } $request->dataof($som->headers);
2870  
2871 27 ▶ die "Can't find method element in the message"
Branch: 1 branch
BranchTrueFalseTotal
unless $request->match($som->method) 2 25 27
2872 unless $request->match($som->method);
2873 # TODO - SOAP::Dispatcher plugs in here
2874 # my $handler = $self->dispatcher->find_handler($request);
2875 25 my($class, $method_uri, $method_name) = $self->find_target($request);
2876 19 my @results = eval {
2877 19 local $^W;
2878 19 my @parameters = $request->paramsin;
2879  
2880 # SOAP::Trace::dispatch($fullname);
2881 19 SOAP::Trace::parameters(@parameters);
2882  
2883 19 ▶ push @parameters, $request
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::isa($class, "SOAP::Server::Parameters") 0 19 19
2884 if UNIVERSAL::isa($class => 'SOAP::Server::Parameters');
2885  
2886 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
2887 SOAP::Server::Object->references(
2888 defined $parameters[0]
2889 && ref $parameters[0]
2890 && UNIVERSAL::isa($parameters[0] => $class)
2891 19 ▶ ? do {
Branch: 1 branch
BranchTrueFalseTotal
defined $parameters[0] && ref $parameters[0] && UNIVERSAL::isa($parameters[0], $class) ? : 0 19 19
Condition50%3/6
defined $parameters[0] and ref $parameters[0] and UNIVERSAL::isa($parameters[0], $class)
!ll&&!rl&&r
1900
defined $parameters[0] and ref $parameters[0]
!ll&&!rl&&r
3160
MC/DC0%0/3
defined $parameters[0] and ref $parameters[0] and UNIVERSAL::isa($parameters[0], $class)
defined $parameters[0] ref $parameters[0] UNIVERSAL::isa($parameters[0], $class)
Truth table50%2/4
A and B and C
A= defined $parameters[0]B= ref $parameters[0]C= UNIVERSAL::isa($parameters[0], $class)
ABCresult
0XX0
10X0
1100
1111
2892 0 my $object = shift @parameters;
2893 0 ▶ SOAP::Server::Object->object(ref $class
Branch: 1 branch
BranchTrueFalseTotal
ref $class ? : 0 0 0
2894 ? $class
2895 : $object
2896 )->$method_name(SOAP::Server::Object->objects(@parameters)),
2897  
2898 # send object back as a header
2899 # preserve name, specify URI
2900 SOAP::Header
2901 ->uri($SOAP::Constants::NS_SL_HEADER => $object)
2902 ->name($request->dataof($som->method.'/[1]')->name)
2903 } # end do block
2904  
2905 # SOAP::Dispatcher will plug-in here as well
2906 # $handler->dispatch(SOAP::Server::Object->objects(@parameters)
2907 : $class->$method_name(SOAP::Server::Object->objects(@parameters)) );
2908 }; # end eval block
2909 19 SOAP::Trace::result(@results);
2910  
2911 # let application errors pass through with 'Server' code
2912 19 ▶ die ref $@
Branch: 3 branches
BranchTrueFalseTotal
if $@ 0 19 19
ref $@ ? : 0 0 0
$@ =~ /^Can\'t locate object method "$method_name"/ ? : 0 0 0
2913 ? $@
2914 : $@ =~ /^Can\'t locate object method "$method_name"/
2915 ? "Failed to locate method ($method_name) in class ($class)"
2916 : SOAP::Fault->faultcode($SOAP::Constants::FAULT_SERVER)->faultstring($@)
2917 if $@;
2918  
2919 19 my $result = $self->serializer
2920 ->prefix('s') # distinguish generated element names between client and server
2921 ->uri($method_uri)
2922 ->envelope(response => $method_name . 'Response', @results);
2923 19 return $result;
2924 };
2925  
2926 # void context
2927 30 ▶ return unless defined wantarray;
Branch: 1 branch
BranchTrueFalseTotal
unless defined wantarray 0 30 30
2928  
2929 # normal result
2930 30 ▶ return $result unless $@;
Branch: 1 branch
BranchTrueFalseTotal
unless $@ 19 11 30
2931  
2932 # check fails, something wrong with message
2933 11 ▶ return $self->make_fault($SOAP::Constants::FAULT_CLIENT, $@) unless ref $@;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $@ 11 0 11
2934  
2935 # died with SOAP::Fault
2936 0 ▶ return $self->make_fault($@->faultcode || $SOAP::Constants::FAULT_SERVER,
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::isa($@, "SOAP::Fault") 0 0 0
Condition0%0/5
$@->faultcode || $SOAP::Constants::FAULT_SERVER
l!l&&r!l&&!r
000
$@->faultstring || 'Application error'
l!l
00
MC/DC0%0/2
$@->faultcode || $SOAP::Constants::FAULT_SERVER
$@->faultcode $SOAP::Constants::FAULT_SERVER
MC/DC0%0/1
$@->faultstring || 'Application error'
$@->faultstring
Truth table0%0/3
A || B
A= $@->faultcodeB= $SOAP::Constants::FAULT_SERVER
ABresult
1X1
011
000
Truth table0%0/2
A
A= $@->faultstring
Aresult
11
00
2937 $@->faultstring || 'Application error',
2938 $@->faultdetail, $@->faultactor)
2939 if UNIVERSAL::isa($@ => 'SOAP::Fault');
2940  
2941 # died with complex detail
2942 0 return $self->make_fault($SOAP::Constants::FAULT_SERVER, 'Application error' => $@);
2943  
2944 } # end of handle()
2945  
2946 sub make_fault {
2947 13 ▶ my $self = shift;
Subroutine make_fault: called CC=2 SCAR=7.6
2948 13 my($code, $string, $detail, $actor) = @_;
2949 13 ▶ $self->serializer->fault($code, $string, $detail, $actor || $self->myuri);
Condition33%1/3
$actor || $self->myuri
l!l&&r!l&&!r
0013
MC/DC0%0/2
$actor || $self->myuri
$actor $self->myuri
Truth table33%1/3
A || B
A= $actorB= $self->myuri
ABresult
1X1
011
000
2950 }
2951  
2952 # ======================================================================
2953  
2954 package SOAP::Trace;
2955  
2956 43 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
2957  
2958 43 my @list = qw(
2959 transport dispatch result
2960 parameters headers objects
2961 method fault freeform
2962 trace debug);
2963 {
2964 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
2965 43 for (@list) {
2966 ▶ *$_ = sub {}
Subroutine __ANON__: called CC=1 SCAR=0.0
2967 473 }
2968 }
2969  
2970 sub defaultlog {
2971 0 ▶ my $caller = (caller(1))[3]; # the 4th element returned by caller is the subroutine name
Subroutine defaultlog: not called CC=2 SCAR=17.9
2972 0 ▶ $caller = (caller(2))[3] if $caller =~ /eval/;
Branch: 1 branch
BranchTrueFalseTotal
if $caller =~ /eval/ 0 0 0
2973 0 chomp(my $msg = join ' ', @_);
2974 0 printf STDERR "%s: %s\n", $caller, $msg;
2975 }
2976  
2977 sub import {
2978 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
2979 43 ▶ no warnings qw{ redefine }; # suppress warnings about redefining
Subroutine BEGIN: called CC=1 SCAR=0.0
2980 2 ▶ my $pack = shift;
Subroutine import: called CC=11 SCAR=26.4
2981 2 my(@notrace, @symbols);
2982 2 for (@_) {
2983 3 ▶ if (ref eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_ eq 'CODE') { } 1 2 3
2984 1 my $call = $_;
2985 1 ▶ foreach (@symbols) { *$_ = sub { $call->(@_) } }
Subroutine __ANON__: not called CC=1 SCAR=0.4
2986 1 @symbols = ();
2987 }
2988 else {
2989 2 local $_ = $_;
2990 2 my $minus = s/^-//;
2991 2 my $all = $_ eq 'all';
2992 2 ▶ Carp::carp "Illegal symbol for tracing ($_)" unless $all || $pack->can($_);
Branch: 1 branch
BranchTrueFalseTotal
unless $all or $pack->can($_) 0 2 2
Condition33%1/3
$all or $pack->can($_)
l!l&&r!l&&!r
020
MC/DC0%0/2
$all or $pack->can($_)
$all $pack->can($_)
Truth table33%1/3
A or B
A= $allB= $pack->can($_)
ABresult
1X1
011
000
2993 2 ▶ $minus ? push(@notrace, $all ? @list : $_) : push(@symbols, $all ? @list : $_);
Branch: 3 branches
BranchTrueFalseTotal
$minus ? : 0 2 2
$all ? : 0 0 0
$all ? : 0 2 2
2994 }
2995 }
2996 2 foreach (@symbols) { *$_ = \&defaultlog }
2997 2 ▶ foreach (@notrace) { *$_ = sub {} }
Subroutine __ANON__: not called CC=1 SCAR=1.2
2998 }
2999  
3000 # ======================================================================
3001  
3002 package SOAP::Custom::XML::Data;
3003  
3004 43 ▶use vars qw(@ISA $AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
3005 43 @ISA = qw(SOAP::Data);
3006  
3007 43 ▶use overload fallback => 1, '""' => sub { shift->value };
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
3008  
3009 sub _compileit {
3010 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
3011 199 ▶ my $method = shift;
Subroutine _compileit: called CC=1 SCAR=0.0
3012 *$method = sub {
3013 return __PACKAGE__->SUPER::name($method => $_[0]->attr->{$method})
3014 207 ▶ if exists $_[0]->attr->{$method};
Subroutine __ANON__: called CC=5 SCAR=16.1
Branch: 1 branch
BranchTrueFalseTotal
if exists $_[0]->attr->{$method} 43 164 207
3015 my @elems = grep {
3016 164 ▶ ref $_ && UNIVERSAL::isa($_ => __PACKAGE__)
Branch: 1 branch
BranchTrueFalseTotal
ref $_ and UNIVERSAL::isa($_, __PACKAGE__) and $_->SUPER::name =~ /(^|:)$method$/ 381 5 386
Condition66%2/3
ref $_ and UNIVERSAL::isa($_, __PACKAGE__)
!ll&&!rl&&r
50381
MC/DC50%1/2
ref $_ and UNIVERSAL::isa($_, __PACKAGE__)
ref $_ UNIVERSAL::isa($_, __PACKAGE__)
Truth table66%2/3
A and B
A= ref $_B= UNIVERSAL::isa($_, __PACKAGE__)
ABresult
0X0
100
111
3017 && $_->SUPER::name =~ /(^|:)$method$/
3018 } $_[0]->value;
3019 164 ▶ return wantarray? @elems : $elems[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 81 83 164
3020 199 };
3021 }
3022  
3023 43 ▶sub BEGIN { foreach (qw(name type import use)) { _compileit($_) } }
Subroutine BEGIN: called CC=2 SCAR=6.9
3024  
3025 sub AUTOLOAD {
3026 27 ▶ my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2);
Subroutine AUTOLOAD: called CC=2 SCAR=7.0
3027 27 ▶ return if $method eq 'DESTROY';
Branch: 1 branch
BranchTrueFalseTotal
if $method eq "DESTROY" 0 27 27
3028  
3029 27 _compileit($method);
3030 27 goto &$AUTOLOAD;
3031 }
3032  
3033 # ======================================================================
3034  
3035 package SOAP::Custom::XML::Deserializer;
3036  
3037 43 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
3038 43 @ISA = qw(SOAP::Deserializer);
3039  
3040 sub decode_value {
3041 189 ▶ my $self = shift;
Subroutine decode_value: called CC=4 SCAR=14.0
3042 189 my $ref = shift;
3043 189 my($name, $attrs, $children, $value) = @$ref;
3044 # base class knows what to do with it
3045 189 ▶ return $self->SUPER::decode_value($ref) if exists $attrs->{href};
Branch: 1 branch
BranchTrueFalseTotal
if exists $attrs->{"href"} 0 189 189
3046  
3047 189 ▶ SOAP::Custom::XML::Data
Branch: 1 branch
BranchTrueFalseTotal
ref $children && @$children ? : 76 113 189
Condition66%2/3
ref $children and @$children
!ll&&!rl&&r
113076
MC/DC50%1/2
ref $children and @$children
ref $children @$children
Truth table66%2/3
A and B
A= ref $childrenB= @$children
ABresult
0X0
100
111
3048 -> SOAP::Data::name($name)
3049 -> attr($attrs)
3050 -> set_value(ref $children && @$children
3051 ? map(scalar(($self->decode_object($_))[1]), @$children)
3052 : $value);
3053 }
3054  
3055 # ======================================================================
3056  
3057 package SOAP::Schema::Deserializer;
3058  
3059 43 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
3060 43 @ISA = qw(SOAP::Custom::XML::Deserializer);
3061  
3062 # ======================================================================
3063  
3064 package SOAP::Schema::WSDL;
3065  
3066 43 ▶use vars qw(%imported @ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
3067 43 @ISA = qw(SOAP::Schema);
3068  
3069 sub new {
3070 6 ▶ my $self = shift;
Subroutine new: called CC=2 SCAR=6.9
3071  
3072 6 ▶ unless (ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $self) 2 4 6
3073 2 my $class = $self;
3074 2 $self = $class->SUPER::new(@_);
3075 }
3076 6 return $self;
3077 }
3078  
3079 sub base {
3080 2 ▶ my $self = shift->new;
Subroutine base: called CC=2 SCAR=6.9
3081 @_
3082 ? ($self->{_base} = shift, return $self)
3083 2 ▶ : return $self->{_base};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 1 1 2
3084 }
3085  
3086 sub import {
3087 1 ▶ my $self = shift->new;
Subroutine import: called CC=10 SCAR=39.1
3088 1 my $s = shift;
3089 1 ▶ my $base = shift || $self->base || die "Missing base argument for ", __PACKAGE__, "\n";
Condition40%2/5
shift() || $self->base || die('Missing base argument for ', __PACKAGE__, "\n")
l!l
10
shift() or $self->base
l!l&&r!l&&!r
010
MC/DC0%0/2
shift() || $self->base || die('Missing base argument for ', __PACKAGE__, "\n")
shift() $self->base
Truth table33%1/3
A or B
A= shift()B= $self->base
ABresult
1X1
011
000
3090  
3091 1 my @a = $s->import;
3092 1 local %imported = %imported;
3093 1 foreach (@a) {
3094 0 ▶ next unless $_->location;
Branch: 1 branch
BranchTrueFalseTotal
unless $_->location 0 0 0
3095 0 my $location = URI->new_abs($_->location->value, $base)->as_string;
3096 0 ▶ if ($imported{$location}++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($SOAP::Schema::WSDL::imported{$location}++) 0 0 0
3097 0 ▶ warn "Recursion loop detected in service description from '$location'. Ignored\n" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 0 0
3098 0 return $s;
3099 }
3100 0 my $root = $self->import(
3101 $self->deserializer->deserialize(
3102 $self->access($location)
3103 )->root, $location);
3104  
3105 $root->SOAP::Data::name eq 'definitions' ? $s->set_value($s->value, $root->value) :
3106 0 ▶ $root->SOAP::Data::name eq 'schema' ? do { # add <types> element if there is no one
Branch: 2 branches
BranchTrueFalseTotal
$root->SOAP::Data::name eq 'definitions' ? : 0 0 0
$root->SOAP::Data::name eq 'schema' ? : 0 0 0
3107 0 ▶ $s->set_value($s->value, $self->deserializer->deserialize('<types></types>')->root) unless $s->types;
Branch: 1 branch
BranchTrueFalseTotal
unless $s->types 0 0 0
3108 0 $s->types->set_value($s->types->value, $root) } :
3109 0 die "Don't know what to do with '@{[$root->SOAP::Data::name]}' in schema imported from '$location'\n";
3110 }
3111  
3112 # return the parsed WSDL file
3113 1 $s;
3114 }
3115  
3116 # TODO - This is woefully incomplete!
3117 sub parse_schema_element {
3118 1 ▶ my $element = shift;
Subroutine parse_schema_element: called CC=5 SCAR=20.9
3119 # Current element is a complex type
3120 1 ▶ if (defined($element->complexType)) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $element->complexType) { } 1 0 1
elsif ($element->simpleType) { } 0 0 0
3121 1 my @elements = ();
3122 1 ▶ if (defined($element->complexType->sequence)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $element->complexType->sequence) 0 1 1
3123  
3124 0 foreach my $e ($element->complexType->sequence->element) {
3125 0 push @elements,parse_schema_element($e);
3126 }
3127 }
3128 1 return @elements;
3129 }
3130 elsif ($element->simpleType) {
3131 }
3132 else {
3133 0 return $element;
3134 }
3135 }
3136  
3137 sub parse {
3138 1 ▶ my $self = shift->new;
Subroutine parse: called CC=32 SCAR=40.9
3139 1 my($s, $service, $port) = @_;
3140 1 my @result;
3141  
3142 # handle imports
3143 1 $self->import($s);
3144  
3145 # handle descriptions without <service>, aka tModel-type descriptions
3146 1 my @services = $s->service;
3147 1 my $tns = $s->{'_attr'}->{'targetNamespace'};
3148 # if there is no <service> element we'll provide it
3149 1 ▶ @services = $self->deserializer->deserialize(<<"FAKE")->root->service unless @services;
Branch: 1 branch
BranchTrueFalseTotal
unless @services 0 1 1
3150 <definitions>
3151 0 ▶ <service name="@{[$service || 'FakeService']}">
Condition0%0/2
$service || 'FakeService'
l!l
00
MC/DC0%0/1
$service || 'FakeService'
$service
Truth table0%0/2
A
A= $service
Aresult
11
00
3152 0 ▶ <port name="@{[$port || 'FakePort']}" binding="@{[$s->binding->name]}"/>
Condition0%0/2
$port || 'FakePort'
l!l
00
MC/DC0%0/1
$port || 'FakePort'
$port
Truth table0%0/2
A
A= $port
Aresult
11
00
3153 </service>
3154 </definitions>
3155 FAKE
3156  
3157 1 my $has_warned = 0;
3158 1 foreach (@services) {
3159 1 my $name = $_->name;
3160 1 ▶ next if $service && $service ne $name;
Branch: 1 branch
BranchTrueFalseTotal
if $service and $service ne $name 0 1 1
Condition33%1/3
$service and $service ne $name
!ll&&!rl&&r
100
MC/DC0%0/2
$service and $service ne $name
$service $service ne $name
Truth table33%1/3
A and B
A= $serviceB= $service ne $name
ABresult
0X0
100
111
3161 1 my %services;
3162 1 foreach ($_->port) {
3163 1 ▶ next if $port && $port ne $_->name;
Branch: 1 branch
BranchTrueFalseTotal
if $port and $port ne $_->name 0 1 1
Condition33%1/3
$port and $port ne $_->name
!ll&&!rl&&r
100
MC/DC0%0/2
$port and $port ne $_->name
$port $port ne $_->name
Truth table33%1/3
A and B
A= $portB= $port ne $_->name
ABresult
0X0
100
111
3164 1 my $binding = SOAP::Utils::disqualify($_->binding);
3165 1 ▶ my $endpoint = ref $_->address ? $_->address->location : undef;
Branch: 1 branch
BranchTrueFalseTotal
ref $_->address ? : 1 0 1
3166 1 foreach ($s->binding) {
3167 # is this a SOAP binding?
3168 1 ▶ next unless grep { $_->uri eq 'http://schemas.xmlsoap.org/wsdl/soap/' } $_->binding;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$_->uri eq "http://schemas.xmlsoap.org/wsdl/soap/";} $_->binding 0 1 1
3169 1 ▶ next unless $_->name eq $binding;
Branch: 1 branch
BranchTrueFalseTotal
unless $_->name eq $binding 0 1 1
3170 1 my $default_style = $_->binding->style;
3171 1 my $porttype = SOAP::Utils::disqualify($_->type);
3172 1 foreach ($_->operation) {
3173 1 my $opername = $_->name;
3174 1 $services{$opername} = {}; # should be initialized in 5.7 and after
3175 1 my $soapaction = $_->operation->soapAction;
3176 1 ▶ my $invocationStyle = $_->operation->style || $default_style || "rpc";
Condition40%2/5
$_->operation->style || $default_style || 'rpc'
l!l
10
$_->operation->style or $default_style
l!l&&r!l&&!r
010
MC/DC0%0/2
$_->operation->style || $default_style || 'rpc'
$_->operation->style $default_style
Truth table33%1/3
A or B
A= $_->operation->styleB= $default_style
ABresult
1X1
011
000
3177 1 ▶ my $encodingStyle = $_->input->body->use || "encoded";
Condition50%1/2
$_->input->body->use || 'encoded'
l!l
10
MC/DC0%0/1
$_->input->body->use || 'encoded'
$_->input->body->use
Truth table50%1/2
A
A= $_->input->body->use
Aresult
11
00
3178 1 ▶ my $namespace = $_->input->body->namespace || $tns;
Condition33%1/3
$_->input->body->namespace || $tns
l!l&&r!l&&!r
010
MC/DC0%0/2
$_->input->body->namespace || $tns
$_->input->body->namespace $tns
Truth table33%1/3
A || B
A= $_->input->body->namespaceB= $tns
ABresult
1X1
011
000
3179 1 my @parts;
3180 1 foreach ($s->portType) {
3181 1 ▶ next unless $_->name eq $porttype;
Branch: 1 branch
BranchTrueFalseTotal
unless $_->name eq $porttype 0 1 1
3182 1 foreach ($_->operation) {
3183 2 ▶ next unless $_->name eq $opername;
Branch: 1 branch
BranchTrueFalseTotal
unless $_->name eq $opername 1 1 2
3184 1 my $inputmessage = SOAP::Utils::disqualify($_->input->message);
3185 1 foreach my $msg ($s->message) {
3186 4 ▶ next unless $msg->name eq $inputmessage;
Branch: 1 branch
BranchTrueFalseTotal
unless $msg->name eq $inputmessage 3 1 4
3187 1 ▶ if ($invocationStyle eq "document" && $encodingStyle eq "literal") {
Branch: 1 branch
BranchTrueFalseTotal
if ($invocationStyle eq 'document' and $encodingStyle eq 'literal') { } 1 0 1
Condition33%1/3
$invocationStyle eq "document" and $encodingStyle eq "literal"
!ll&&!rl&&r
001
MC/DC0%0/2
$invocationStyle eq "document" and $encodingStyle eq "literal"
$invocationStyle eq "document" $encodingStyle eq "literal"
Truth table33%1/3
A and B
A= $invocationStyle eq "document"B= $encodingStyle eq "literal"
ABresult
0X0
100
111
3188 # warn "document/literal support is EXPERIMENTAL in SOAP::Lite"
3189 # if !$has_warned && ($has_warned = 1);
3190 1 my ($input_ns,$input_name) = SOAP::Utils::splitqname($msg->part->element);
3191 1 foreach my $schema ($s->types->schema) {
3192 1 foreach my $element ($schema->element) {
3193 2 ▶ next unless $element->name eq $input_name;
Branch: 1 branch
BranchTrueFalseTotal
unless $element->name eq $input_name 2 0 2
3194 0 push @parts,parse_schema_element($element);
3195 }
3196 1 $services{$opername}->{parameters} = [ @parts ];
3197 }
3198 }
3199 else {
3200 # TODO - support all combinations of doc|rpc/lit|enc.
3201 #warn "$invocationStyle/$encodingStyle is not supported in this version of SOAP::Lite";
3202 0 @parts = $msg->part;
3203 0 $services{$opername}->{parameters} = [ @parts ];
3204 }
3205 }
3206 }
3207  
3208 1 for ($services{$opername}) {
3209 1 $_->{endpoint} = $endpoint;
3210 1 $_->{soapaction} = $soapaction;
3211 1 $_->{namespace} = $namespace;
3212 # $_->{parameters} = [@parts];
3213 }
3214 }
3215 }
3216 }
3217 }
3218 # fix nonallowed characters in package name, and add 's' if started with digit
3219 1 for ($name) { s/\W+/_/g; s/^(\d)/s$1/ }
3220 1 push @result, $name => \%services;
3221 }
3222 1 return @result;
3223 }
3224  
3225 # ======================================================================
3226  
3227 # Naming? SOAP::Service::Schema?
3228 package SOAP::Schema;
3229  
3230 43 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
3231  
3232 3 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
3233  
3234 sub new {
3235 20 ▶ my $self = shift;
Subroutine new: called CC=7 SCAR=21.5
3236 20 ▶ return $self if ref $self;
Branch: 1 branch
BranchTrueFalseTotal
if ref $self 17 3 20
3237 3 ▶ unless (ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $self) 3 0 3
3238 3 my $class = $self;
3239 3 require LWP::UserAgent;
3240 3 $self = bless {
3241 '_deserializer' => SOAP::Schema::Deserializer->new,
3242 '_useragent' => LWP::UserAgent->new,
3243 }, $class;
3244  
3245 3 SOAP::Trace::objects('()');
3246 }
3247  
3248 3 ▶ Carp::carp "Odd (wrong?) number of parameters in new()" if $^W && (@_ & 1);
Branch: 1 branch
BranchTrueFalseTotal
if $^W and @_ & 1 0 3 3
Condition33%1/3
$^W and @_ & 1
!ll&&!rl&&r
300
MC/DC0%0/2
$^W and @_ & 1
$^W @_ & 1
Truth table33%1/3
A and B
A= $^WB= @_ & 1
ABresult
0X0
100
111
3249 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
3250 3 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 3 3
3251 0 my $method = shift;
3252 0 ▶ $self->$method(shift) if $self->can($method)
Branch: 1 branch
BranchTrueFalseTotal
if $self->can($method) 0 0 0
3253 }
3254  
3255 3 return $self;
3256 }
3257  
3258 sub schema {
3259 0 ▶ warn "SOAP::Schema->schema has been deprecated. "
Subroutine schema: not called CC=1 SCAR=6.9
3260 . "Please use SOAP::Schema->schema_url instead.";
3261 0 return shift->schema_url(@_);
3262 }
3263  
3264 sub BEGIN {
3265 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
3266 43 ▶ for my $method (qw(deserializer schema_url services useragent stub cache_dir cache_ttl)) {
Subroutine BEGIN: called CC=2 SCAR=6.9
3267 301 my $field = '_' . $method;
3268 *$method = sub {
3269 15 ▶ my $self = shift->new;
Subroutine __ANON__: called CC=2 SCAR=6.9
3270 15 ▶ @_ ? ($self->{$field} = shift, return $self) : return $self->{$field};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3 12 15
3271 }
3272 301 }
3273 }
3274  
3275 sub parse {
3276 1 ▶ my $self = shift;
Subroutine parse: called CC=1 SCAR=0.0
3277 1 my $s = $self->deserializer->deserialize($self->access)->root;
3278 # here should be something that defines what schema description we want to use
3279 1 $self->services({SOAP::Schema::WSDL->base($self->schema_url)->useragent($self->useragent)->parse($s, @_)});
3280  
3281 }
3282  
3283 sub refresh_cache {
3284 0 ▶ my $self = shift;
Subroutine refresh_cache: not called CC=2 SCAR=17.9
3285 0 my ($filename,$contents) = @_;
3286 0 ▶ open CACHE,">$filename" or Carp::croak "Could not open cache file for writing: $!";
Branch: 1 branch
BranchTrueFalseTotal
open CACHE, ">$filename" or Carp::croak("Could not open cache file for writing: $!") 0 0 0
3287 0 print CACHE $contents;
3288 0 close CACHE;
3289 }
3290  
3291 sub load {
3292 1 ▶ my $self = shift->new;
Subroutine load: called CC=11 SCAR=32.1
3293 1 local $^W; # suppress warnings about redefining
3294 1 ▶ foreach (keys %{$self->services || Carp::croak 'Nothing to load. Schema is not specified'}) {
Branch: 1 branch
BranchTrueFalseTotal
$self->services or Carp::croak("Nothing to load. Schema is not specified") 0 1 1
3295 # TODO - check age of cached file, and delete if older than configured amount
3296 1 ▶ if ($self->cache_dir) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->cache_dir) { } 0 1 1
3297 0 my $cached_file = File::Spec->catfile($self->cache_dir,$_.".pm");
3298 0 ▶ my $ttl = $self->cache_ttl || $SOAP::Constants::DEFAULT_CACHE_TTL;
Condition0%0/3
$self->cache_ttl || $SOAP::Constants::DEFAULT_CACHE_TTL
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->cache_ttl || $SOAP::Constants::DEFAULT_CACHE_TTL
$self->cache_ttl $SOAP::Constants::DEFAULT_CACHE_TTL
Truth table0%0/3
A || B
A= $self->cache_ttlB= $SOAP::Constants::DEFAULT_CACHE_TTL
ABresult
1X1
011
000
3299 0 open (CACHE, "<$cached_file");
3300 0 ▶ my @stat = stat($cached_file) unless eof(CACHE);
Branch: 1 branch
BranchTrueFalseTotal
unless eof CACHE 0 0 0
3301 0 close CACHE;
3302 0 ▶ if (@stat) {
Branch: 1 branch
BranchTrueFalseTotal
if (@stat) { } 0 0 0
3303 # Cache exists
3304 0 my $cache_lived = time() - $stat[9];
3305 0 ▶ if ($ttl > 0 && $cache_lived > $ttl) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ttl > 0 and $cache_lived > $ttl) 0 0 0
Condition0%0/3
$ttl > 0 and $cache_lived > $ttl
!ll&&!rl&&r
000
MC/DC0%0/2
$ttl > 0 and $cache_lived > $ttl
$ttl > 0 $cache_lived > $ttl
Truth table0%0/3
A and B
A= $ttl > 0B= $cache_lived > $ttl
ABresult
0X0
100
111
3306 0 $self->refresh_cache($cached_file,$self->generate_stub($_));
3307 }
3308 }
3309 else {
3310 # Cache doesn't exist
3311 0 $self->refresh_cache($cached_file,$self->generate_stub($_));
3312 }
3313 0 push @INC,$self->cache_dir;
3314 0 ▶ eval "require $_" or Carp::croak "Could not load cached file: $@";
Branch: 1 branch
BranchTrueFalseTotal
eval "require $_" or Carp::croak("Could not load cached file: $@") 0 0 0
3315 }
3316 else {
3317 1 ▶ eval $self->generate_stub($_) or Carp::croak "Bad stub: $@";
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
eval $self->generate_stub($_) or Carp::croak("Bad stub: $@") 0 1 1
3318 }
3319 }
3320 1 $self;
3321 }
3322  
3323 sub access {
3324 1 ▶ my $self = shift->new;
Subroutine access: called CC=7 SCAR=23.4
3325 1 ▶ my $url = shift || $self->schema_url || Carp::croak 'Nothing to access. URL is not specified';
Condition33%2/6
shift() || $self->schema_url || Carp::croak('Nothing to access. URL is not specified')
l!l&&r!l&&!r
100
shift() or $self->schema_url
l!l&&r!l&&!r
010
MC/DC0%0/3
shift() || $self->schema_url || Carp::croak('Nothing to access. URL is not specified')
shift() $self->schema_url Carp::croak('Nothing to access. URL is not specified')
Truth table25%1/4
A or B || C
A= shift()B= $self->schema_urlC= Carp::croak('Nothing to access. URL is not specified')
ABCresult
1XX1
01X1
0011
0000
3326 1 ▶ $self->useragent->env_proxy if $ENV{'HTTP_proxy'};
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"HTTP_proxy"} 0 1 1
3327  
3328 1 my $req = HTTP::Request->new(GET => $url);
3329 $req->proxy_authorization_basic($ENV{'HTTP_proxy_user'}, $ENV{'HTTP_proxy_pass'})
3330 1 ▶ if ($ENV{'HTTP_proxy_user'} && $ENV{'HTTP_proxy_pass'});
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"HTTP_proxy_user"} and $ENV{"HTTP_proxy_pass"} 0 1 1
Condition33%1/3
$ENV{"HTTP_proxy_user"} and $ENV{"HTTP_proxy_pass"}
!ll&&!rl&&r
100
MC/DC0%0/2
$ENV{"HTTP_proxy_user"} and $ENV{"HTTP_proxy_pass"}
$ENV{"HTTP_proxy_user"} $ENV{"HTTP_proxy_pass"}
Truth table33%1/3
A and B
A= $ENV{"HTTP_proxy_user"}B= $ENV{"HTTP_proxy_pass"}
ABresult
0X0
100
111
3331  
3332 1 my $resp = $self->useragent->request($req);
3333 1 ▶ $resp->is_success ? $resp->content : die "Service description '$url' can't be loaded: ", $resp->status_line, "\n";
Branch: 1 branch
BranchTrueFalseTotal
$resp->is_success ? : 1 0 1
3334 }
3335  
3336 sub generate_stub {
3337 1 ▶ my $self = shift->new;
Subroutine generate_stub: called CC=9 SCAR=24.1
3338 1 my $package = shift;
3339 1 my $services = $self->services->{$package};
3340 1 my $schema_url = $self->schema_url;
3341  
3342 1 $self->{'_stub'} = <<"EOP";
3343 package $package;
3344 # Generated by SOAP::Lite (v$SOAP::Lite::VERSION) for Perl -- soaplite.com
3345 # Copyright (C) 2000-2006 Paul Kulchenko, Byrne Reese
3346 1 # -- generated at [@{[scalar localtime]}]
3347 EOP
3348 1 ▶ $self->{'_stub'} .= "# -- generated from $schema_url\n" if $schema_url;
Branch: 1 branch
BranchTrueFalseTotal
if $schema_url 1 0 1
3349 1 $self->{'_stub'} .= 'my %methods = ('."\n";
3350 1 foreach my $service (keys %$services) {
3351 1 $self->{'_stub'} .= "'$service' => {\n";
3352 1 foreach (qw(endpoint soapaction namespace)) {
3353 3 $self->{'_stub'} .= " $_ => '".$services->{$service}{$_}."',\n";
3354 }
3355 1 $self->{'_stub'} .= " parameters => [\n";
3356 1 foreach (@{$services->{$service}{parameters}}) {
3357 # This is a workaround for https://sourceforge.net/tracker/index.php?func=detail&aid=2001592&group_id=66000&atid=513017
3358 0 ▶ next unless ref $_;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $_ 0 0 0
3359 0 $self->{'_stub'} .= " SOAP::Data->new(name => '".$_->name."', type => '".$_->type."', attr => {";
3360 0 $self->{'_stub'} .= do {
3361 0 my %attr = %{$_->attr};
3362 0 join(', ', map {"'$_' => '$attr{$_}'"}
3363 0 grep {/^xmlns:(?!-)/}
3364 keys %attr);
3365 };
3366 0 $self->{'_stub'} .= "}),\n";
3367 }
3368 1 $self->{'_stub'} .= " ], # end parameters\n";
3369 1 $self->{'_stub'} .= " }, # end $service\n";
3370 }
3371 1 $self->{'_stub'} .= "); # end my %methods\n";
3372 1 $self->{'_stub'} .= <<'EOP';
3373  
3374 use SOAP::Lite;
3375 use Exporter;
3376 use Carp ();
3377  
3378 use vars qw(@ISA $AUTOLOAD @EXPORT_OK %EXPORT_TAGS);
3379 @ISA = qw(Exporter SOAP::Lite);
3380 @EXPORT_OK = (keys %methods);
3381 %EXPORT_TAGS = ('all' => [@EXPORT_OK]);
3382  
3383 sub _call {
3384 my ($self, $method) = (shift, shift);
3385 my $name = UNIVERSAL::isa($method => 'SOAP::Data') ? $method->name : $method;
3386 my %method = %{$methods{$name}};
3387 $self->proxy($method{endpoint} || Carp::croak "No server address (proxy) specified")
3388 unless $self->proxy;
3389 my @templates = @{$method{parameters}};
3390 my @parameters = ();
3391 foreach my $param (@_) {
3392 if (@templates) {
3393 my $template = shift @templates;
3394 my ($prefix,$typename) = SOAP::Utils::splitqname($template->type);
3395 my $method = 'as_'.$typename;
3396 # TODO - if can('as_'.$typename) {...}
3397 my $result = $self->serializer->$method($param, $template->name, $template->type, $template->attr);
3398 push(@parameters, $template->value($result->[2]));
3399 }
3400 else {
3401 push(@parameters, $param);
3402 }
3403 }
3404 $self->endpoint($method{endpoint})
3405 ->ns($method{namespace})
3406 ->on_action(sub{qq!"$method{soapaction}"!});
3407 EOP
3408 1 my $namespaces = $self->deserializer->ids->[1];
3409 1 foreach my $key (keys %{$namespaces}) {
3410 7 my ($ns,$prefix) = SOAP::Utils::splitqname($key);
3411 7 ▶ $self->{'_stub'} .= ' $self->serializer->register_ns("'.$namespaces->{$key}.'","'.$prefix.'");'."\n"
Branch: 1 branch
BranchTrueFalseTotal
if defined $ns and $ns eq "xmlns" 4 3 7
Condition66%2/3
defined $ns and $ns eq "xmlns"
!ll&&!rl&&r
304
MC/DC50%1/2
defined $ns and $ns eq "xmlns"
defined $ns $ns eq "xmlns"
Truth table66%2/3
A and B
A= defined $nsB= $ns eq "xmlns"
ABresult
0X0
100
111
3412 if (defined $ns && ($ns eq "xmlns"));
3413 }
3414 1 $self->{'_stub'} .= <<'EOP';
3415 my $som = $self->SUPER::call($method => @parameters);
3416 if ($self->want_som) {
3417 return $som;
3418 }
3419 UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ? $som->paramsall : $som->result : $som;
3420 }
3421  
3422 sub BEGIN {
3423 no strict 'refs';
3424 for my $method (qw(want_som)) {
3425 my $field = '_' . $method;
3426 *$method = sub {
3427 my $self = shift->new;
3428 @_ ? ($self->{$field} = shift, return $self) : return $self->{$field};
3429 }
3430 }
3431 }
3432 no strict 'refs';
3433 for my $method (@EXPORT_OK) {
3434 my %method = %{$methods{$method}};
3435 *$method = sub {
3436 my $self = UNIVERSAL::isa($_[0] => __PACKAGE__)
3437 ? ref $_[0]
3438 ? shift # OBJECT
3439 # CLASS, either get self or create new and assign to self
3440 : (shift->self || __PACKAGE__->self(__PACKAGE__->new))
3441 # function call, either get self or create new and assign to self
3442 : (__PACKAGE__->self || __PACKAGE__->self(__PACKAGE__->new));
3443 $self->_call($method, @_);
3444 }
3445 }
3446  
3447 sub AUTOLOAD {
3448 my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2);
3449 return if $method eq 'DESTROY' || $method eq 'want_som';
3450 die "Unrecognized method '$method'. List of available method(s): @EXPORT_OK\n";
3451 }
3452  
3453 1;
3454 EOP
3455 1 return $self->stub;
3456 }
3457  
3458 # ======================================================================
3459  
3460 package SOAP;
3461  
3462 43 ▶use vars qw($AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
3463 43 require URI;
3464  
3465 43 my $soap; # shared between SOAP and SOAP::Lite packages
3466  
3467 {
3468 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
3469 *AUTOLOAD = sub {
3470 115177 ▶ local($1,$2);
Subroutine __ANON__: called CC=23 SCAR=59.2
3471 115177 my($package, $method) = $AUTOLOAD =~ m/(?:(.+)::)([^:]+)$/;
3472 115177 ▶ return if $method eq 'DESTROY';
Branch: 1 branch
BranchTrueFalseTotal
if $method eq "DESTROY" 115176 1 115177
3473  
3474 1 ▶ my $soap = ref $_[0] && UNIVERSAL::isa($_[0] => 'SOAP::Lite')
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] && UNIVERSAL::isa($_[0], 'SOAP::Lite') ? : 0 1 1
Condition40%2/5
ref $_[0] and UNIVERSAL::isa($_[0], "SOAP::Lite")
!ll&&!rl&&r
100
$soap or die "SOAP:: prefix shall only be used in combination with +autodispatch option\n"
l!l
01
MC/DC0%0/2
ref $_[0] and UNIVERSAL::isa($_[0], "SOAP::Lite")
ref $_[0] UNIVERSAL::isa($_[0], "SOAP::Lite")
MC/DC0%0/1
$soap or die "SOAP:: prefix shall only be used in combination with +autodispatch option\n"
$soap
Truth table33%1/3
A and B
A= ref $_[0]B= UNIVERSAL::isa($_[0], "SOAP::Lite")
ABresult
0X0
100
111
Truth table50%1/2
A
A= $soap
Aresult
11
00
3475 ? $_[0]
3476 : $soap
3477 || die "SOAP:: prefix shall only be used in combination with +autodispatch option\n";
3478  
3479 0 my $uri = URI->new($soap->uri);
3480 0 my $currenturi = $uri->path;
3481 0 ▶ $package = ref $_[0] && UNIVERSAL::isa($_[0] => 'SOAP::Lite')
Branch: 4 branches
BranchTrueFalseTotal
ref $_[0] && UNIVERSAL::isa($_[0], 'SOAP::Lite') ? : 0 0 0
$package eq 'SOAP' ? : 0 0 0
$_[0] eq 'SOAP' ? : 0 0 0
$package eq 'main' ? : 0 0 0
Condition0%0/12
ref $_[0] and UNIVERSAL::isa($_[0], "SOAP::Lite")
!ll&&!rl&&r
000
ref $_[0] or $_[0] eq "SOAP" ? $currenturi || Carp::croak("URI is not specified for method call") : $_[0]
l!l&&r!l&&!r
000
$currenturi or Carp::croak("URI is not specified for method call")
l!l&&r!l&&!r
000
$currenturi or $package
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $_[0] and UNIVERSAL::isa($_[0], "SOAP::Lite")
ref $_[0] UNIVERSAL::isa($_[0], "SOAP::Lite")
MC/DC0%0/2
ref $_[0] or $_[0] eq "SOAP" ? $currenturi || Carp::croak("URI is not specified for method call") : $_[0]
ref $_[0] $_[0] eq "SOAP" ? $currenturi || Carp::croak("URI is not specified for method call") : $_[0]
MC/DC0%0/2
$currenturi or Carp::croak("URI is not specified for method call")
$currenturi Carp::croak("URI is not specified for method call")
MC/DC0%0/2
$currenturi or $package
$currenturi $package
Truth table0%0/3
A and B
A= ref $_[0]B= UNIVERSAL::isa($_[0], "SOAP::Lite")
ABresult
0X0
100
111
Truth table0%0/3
A or B
A= ref $_[0]B= $_[0] eq "SOAP" ? $currenturi || Carp::croak("URI is not specified for method call") : $_[0]
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= $currenturiB= Carp::croak("URI is not specified for method call")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= $currenturiB= $package
ABresult
1X1
011
000
3482 ? $currenturi
3483 : $package eq 'SOAP'
3484 ? ref $_[0] || ($_[0] eq 'SOAP'
3485 ? $currenturi || Carp::croak "URI is not specified for method call"
3486 : $_[0])
3487 : $package eq 'main'
3488 ? $currenturi || $package
3489 : $package;
3490  
3491 # drop first parameter if it's a class name
3492 {
3493 0 my $pack = $package;
3494 0 for ($pack) { s!^/!!; s!/!::!g; }
3495 0 ▶ shift @_ if @_ && !ref $_[0] && ($_[0] eq $pack || $_[0] eq 'SOAP')
Branch: 1 branch
BranchTrueFalseTotal
if @_ and not ref $_[0] and $_[0] eq $pack || $_[0] eq "SOAP" or ref $_[0] and UNIVERSAL::isa($_[0], "SOAP::Lite") 0 0 0
Condition0%0/15
@_ and not ref $_[0] and $_[0] eq $pack || $_[0] eq "SOAP" or ref $_[0] and UNIVERSAL::isa($_[0], "SOAP::Lite")
l!l&&r!l&&!r
000
@_ and not ref $_[0] and $_[0] eq $pack || $_[0] eq "SOAP"
!ll&&!rl&&r
000
@_ and not ref $_[0]
!ll&&!rl&&r
000
$_[0] eq $pack or $_[0] eq "SOAP"
l!l&&r!l&&!r
000
ref $_[0] and UNIVERSAL::isa($_[0], "SOAP::Lite")
!ll&&!rl&&r
000
MC/DC0%0/6
@_ and not ref $_[0] and $_[0] eq $pack || $_[0] eq "SOAP" or ref $_[0] and UNIVERSAL::isa($_[0], "SOAP::Lite")
@_ not ref $_[0] $_[0] eq $pack $_[0] eq "SOAP" ref $_[0] UNIVERSAL::isa($_[0], "SOAP::Lite")
Truth table0%0/11
A and not(B) and C or D or E and F
A= @_B= not ref $_[0]C= $_[0] eq $packD= $_[0] eq "SOAP"E= ref $_[0]F= UNIVERSAL::isa($_[0], "SOAP::Lite")
ABCDEFresult
111XXX1
1101XX1
0XXX111
10XX111
1100111
0XXX0X0
0XXX100
10XX0X0
10XX100
11000X0
1100100
3496 || ref $_[0] && UNIVERSAL::isa($_[0] => 'SOAP::Lite');
3497 }
3498  
3499 0 for ($package) { s!::!/!g; s!^/?!/!; }
3500 0 $uri->path($package);
3501  
3502 0 my $som = $soap->uri($uri->as_string)->call($method => @_);
3503 0 ▶ UNIVERSAL::isa($som => 'SOAP::SOM')
Branch: 2 branches
BranchTrueFalseTotal
UNIVERSAL::isa($som, 'SOAP::SOM') ? : 0 0 0
wantarray ? : 0 0 0
3504 ? wantarray
3505 ? $som->paramsall
3506 : $som->result
3507 : $som;
3508 43 };
3509 }
3510  
3511 # ======================================================================
3512  
3513 package SOAP::Lite;
3514  
3515 43 ▶use vars qw($AUTOLOAD @ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
3516 43 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
3517  
3518 43 ▶use SOAP::Lite::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
3519 43 ▶use SOAP::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
3520 43 ▶use SOAP::Packager;
Subroutine BEGIN: called CC=1 SCAR=0.0
3521  
3522 43 ▶use Scalar::Util qw(weaken blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
3523  
3524 43 @ISA = qw(SOAP::Cloneable);
3525  
3526 # provide access to global/autodispatched object
3527 sub self {
3528 0 ▶ @_ > 1
Subroutine self: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ > 1 ? : 0 0 0
3529 ? $soap = $_[1]
3530 : $soap
3531 }
3532  
3533 # no more warnings about "used only once"
3534 43 *UNIVERSAL::AUTOLOAD if 0;
3535  
3536 0 ▶sub autodispatched { \&{*UNIVERSAL::AUTOLOAD} eq \&{*SOAP::AUTOLOAD} };
Subroutine autodispatched: not called CC=1 SCAR=6.9
Pod undocumented
3537  
3538 sub on_debug {
3539 0 ▶ my $self = shift;
Subroutine on_debug: not called CC=1 SCAR=6.9
Pod documented
3540 0 my ($logger) = @_;
3541 #print "DEBUG: self=$self\n";
3542 #print "DEBUG: logger=$logger\n";
3543 #print "DEBUG: transport=$self->transport\n";
3544 #print "DEBUG: Lite.pm: calling setDebugLogger\n";
3545 0 $self->transport->setDebugLogger($logger);
3546 }
3547  
3548 sub soapversion {
3549 268 ▶ my $self = shift;
Subroutine soapversion: called CC=6 SCAR=18.8
Pod documented
3550 268 ▶ my $version = shift or return $SOAP::Constants::SOAP_VERSION;
Branch: 1 branch
BranchTrueFalseTotal
my $version = shift() or return $SOAP::Constants::SOAP_VERSION 162 106 268
3551  
3552 ($version) = grep {
3553 126 $SOAP::Constants::SOAP_VERSIONS{$_}->{NS_ENV} eq $version
3554 } keys %SOAP::Constants::SOAP_VERSIONS
3555 106 ▶ unless exists $SOAP::Constants::SOAP_VERSIONS{$version};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $SOAP::Constants::SOAP_VERSIONS{$version} 63 43 106
3556  
3557 die qq!$SOAP::Constants::WRONG_VERSION Supported versions:\n@{[
3558 0 join "\n", map {" $_ ($SOAP::Constants::SOAP_VERSIONS{$_}->{NS_ENV})"} keys %SOAP::Constants::SOAP_VERSIONS
3559 ]}\n!
3560 106 ▶ unless defined($version) && defined(my $def = $SOAP::Constants::SOAP_VERSIONS{$version});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $version and defined(my $def = $SOAP::Constants::SOAP_VERSIONS{$version}) 0 106 106
Condition33%1/3
defined $version and defined(my $def = $SOAP::Constants::SOAP_VERSIONS{$version})
!ll&&!rl&&r
00106
MC/DC0%0/2
defined $version and defined(my $def = $SOAP::Constants::SOAP_VERSIONS{$version})
defined $version defined(my $def = $SOAP::Constants::SOAP_VERSIONS{$version})
Truth table33%1/3
A and B
A= defined $versionB= defined(my $def = $SOAP::Constants::SOAP_VERSIONS{$version})
ABresult
0X0
100
111
3561  
3562 106 foreach (keys %$def) {
3563 530 eval "\$SOAP::Constants::$_ = '$SOAP::Constants::SOAP_VERSIONS{$version}->{$_}'";
3564 }
3565  
3566 106 $SOAP::Constants::SOAP_VERSION = $version;
3567  
3568 106 return $self;
3569 }
3570  
3571 43 ▶BEGIN { SOAP::Lite->soapversion(1.1) }
Subroutine BEGIN: called CC=1 SCAR=0.0
3572  
3573 sub import {
3574 68 ▶ my $pkg = shift;
Subroutine import: called CC=25 SCAR=39.8
3575 68 my $caller = caller;
3576 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
3577 # emulate 'use SOAP::Lite 0.99' behavior
3578 68 ▶ $pkg->require_version(shift) if defined $_[0] && $_[0] =~ /^\d/;
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0] and $_[0] =~ /^\d/ 0 68 68
Condition66%2/3
defined $_[0] and $_[0] =~ /^\d/
!ll&&!rl&&r
6080
MC/DC0%0/2
defined $_[0] and $_[0] =~ /^\d/
defined $_[0] $_[0] =~ /^\d/
Truth table66%2/3
A and B
A= defined $_[0]B= $_[0] =~ /^\d/
ABresult
0X0
100
111
3579  
3580 68 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 10 68 78
3581 10 my $command = shift;
3582  
3583 my @parameters = UNIVERSAL::isa($_[0] => 'ARRAY')
3584 10 ▶ ? @{shift()}
Branch: 2 branches
BranchTrueFalseTotal
if @_ and $command ne "autodispatch" 9 1 10
UNIVERSAL::isa($_[0], 'ARRAY') ? : 2 7 9
Condition66%2/3
@_ and $command ne "autodispatch"
!ll&&!rl&&r
019
MC/DC50%1/2
@_ and $command ne "autodispatch"
@_ $command ne "autodispatch"
Truth table66%2/3
A and B
A= @_B= $command ne "autodispatch"
ABresult
0X0
100
111
3585 : shift
3586 if @_ && $command ne 'autodispatch';
3587  
3588 10 ▶ if ($command eq 'autodispatch' || $command eq 'dispatch_from') {
Branch: 4 branches
BranchTrueFalseTotal
if ($command eq 'autodispatch' or $command eq 'dispatch_from') { } 1 9 10
elsif ($command eq 'service') { } 0 9 9
elsif ($command eq 'debug' or $command eq 'trace') { } 2 7 9
elsif ($command eq 'import') { } 0 7 7
Condition66%2/3
$command eq "autodispatch" or $command eq "dispatch_from"
l!l&&r!l&&!r
109
MC/DC50%1/2
$command eq "autodispatch" or $command eq "dispatch_from"
$command eq "autodispatch" $command eq "dispatch_from"
Truth table66%2/3
A or B
A= $command eq "autodispatch"B= $command eq "dispatch_from"
ABresult
1X1
011
000
3589 1 ▶ $soap = ($soap||$pkg)->new;
Condition33%1/3
$soap || $pkg
l!l&&r!l&&!r
010
MC/DC0%0/2
$soap || $pkg
$soap $pkg
Truth table33%1/3
A || B
A= $soapB= $pkg
ABresult
1X1
011
000
3590 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
3591 1 ▶ foreach ($command eq 'autodispatch'
Branch: 1 branch
BranchTrueFalseTotal
$command eq 'autodispatch' ? : 1 0 1
3592 ? 'UNIVERSAL'
3593 : @parameters
3594 ) {
3595 1 my $sub = "${_}::AUTOLOAD";
3596 1 ▶ defined &{*$sub}
Branch: 1 branch
BranchTrueFalseTotal
\&{*$sub;} eq \&{*SOAP::AUTOLOAD;} ? : 0 0 0
3597 1 ▶ ? (\&{*$sub} eq \&{*SOAP::AUTOLOAD}
Branch: 1 branch
BranchTrueFalseTotal
defined &{*$sub;} ? : 0 1 1
3598 ? ()
3599 : Carp::croak "$sub already assigned and won't work with DISPATCH. Died")
3600 : (*$sub = *SOAP::AUTOLOAD);
3601 }
3602 }
3603 elsif ($command eq 'service') {
3604 0 foreach (keys %{SOAP::Schema->schema_url(shift(@parameters))->parse(@parameters)->load->services}) {
3605 0 $_->export_to_level(1, undef, ':all');
3606 }
3607 }
3608 ▶ elsif ($command eq 'debug' || $command eq 'trace') {
Condition66%2/3
$command eq "debug" or $command eq "trace"
l!l&&r!l&&!r
027
MC/DC50%1/2
$command eq "debug" or $command eq "trace"
$command eq "debug" $command eq "trace"
Truth table66%2/3
A or B
A= $command eq "debug"B= $command eq "trace"
ABresult
1X1
011
000
3609 2 ▶ SOAP::Trace->import(@parameters ? @parameters : 'all');
Branch: 1 branch
BranchTrueFalseTotal
@parameters ? : 2 0 2
3610 }
3611 elsif ($command eq 'import') {
3612 0 local $^W; # suppress warnings about redefining
3613 0 my $package = shift(@parameters);
3614 0 ▶ $package->export_to_level(1, undef, @parameters ? @parameters : ':all') if $package;
Branch: 2 branches
BranchTrueFalseTotal
if $package 0 0 0
@parameters ? : 0 0 0
3615 }
3616 else {
3617 7 ▶ Carp::carp "Odd (wrong?) number of parameters in import(), still continue" if $^W && !(@parameters & 1);
Branch: 1 branch
BranchTrueFalseTotal
if $^W and not @parameters & 1 0 7 7
Condition66%2/3
$^W and not @parameters & 1
!ll&&!rl&&r
520
MC/DC0%0/2
$^W and not @parameters & 1
$^W not @parameters & 1
Truth table66%2/3
A and not(B)
A= $^WB= not @parameters & 1
ABresult
0X0
100
111
3618 7 ▶ $soap = ($soap||$pkg)->$command(@parameters);
Condition66%2/3
$soap || $pkg
l!l&&r!l&&!r
250
MC/DC0%0/2
$soap || $pkg
$soap $pkg
Truth table66%2/3
A || B
A= $soapB= $pkg
ABresult
1X1
011
000
3619 }
3620 }
3621 }
3622  
3623 28 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
3624  
3625 sub new {
3626 295 ▶ my $self = shift;
Subroutine new: called CC=11 SCAR=25.7
Pod documented
3627 295 ▶ return $self if ref $self;
Branch: 1 branch
BranchTrueFalseTotal
if ref $self 266 29 295
3628 29 ▶ unless (ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $self) 29 0 29
3629 29 my $class = $self;
3630 # Check whether we can clone. Only the SAME class allowed, no inheritance
3631 $self = ref($soap) eq $class ? $soap->clone : {
3632 _transport => SOAP::Transport->new,
3633 _serializer => SOAP::Serializer->new,
3634 _deserializer => SOAP::Deserializer->new,
3635 _packager => SOAP::Packager::MIME->new,
3636 _schema => undef,
3637 _autoresult => 0,
3638 16 ▶ _on_action => sub { sprintf '"%s#%s"', shift || '', shift },
Subroutine __ANON__: called CC=2 SCAR=6.9
Condition100%2/2
shift() || ''
l!l
115
MC/DC100%1/1
shift() || ''
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
3639 1 ▶ _on_fault => sub {ref $_[1] ? return $_[1] : Carp::croak $_[0]->transport->is_success ? $_[1] : $_[0]->transport->status},
Subroutine __ANON__: called CC=3 SCAR=16.0
Branch: 2 branches
BranchTrueFalseTotal
ref $_[1] ? : 1 0 1
$_[0]->transport->is_success ? : 0 0 0
3640 29 ▶ };
Branch: 1 branch
BranchTrueFalseTotal
ref $soap eq $class ? : 5 24 29
3641 29 bless $self => $class;
3642 29 ▶ $self->on_nonserialized($self->on_nonserialized || $self->serializer->on_nonserialized);
Condition66%2/3
$self->on_nonserialized || $self->serializer->on_nonserialized
l!l&&r!l&&!r
5240
MC/DC0%0/2
$self->on_nonserialized || $self->serializer->on_nonserialized
$self->on_nonserialized $self->serializer->on_nonserialized
Truth table66%2/3
A || B
A= $self->on_nonserializedB= $self->serializer->on_nonserialized
ABresult
1X1
011
000
3643 29 SOAP::Trace::objects('()');
3644 }
3645  
3646 29 ▶ Carp::carp "Odd (wrong?) number of parameters in new()" if $^W && (@_ & 1);
Branch: 1 branch
BranchTrueFalseTotal
if $^W and @_ & 1 0 29 29
Condition66%2/3
$^W and @_ & 1
!ll&&!rl&&r
2810
MC/DC0%0/2
$^W and @_ & 1
$^W @_ & 1
Truth table66%2/3
A and B
A= $^WB= @_ & 1
ABresult
0X0
100
111
3647 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
3648 29 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 6 29 35
3649 6 my($method, $params) = splice(@_,0,2);
3650 6 ▶ $self->can($method)
Branch: 2 branches
BranchTrueFalseTotal
$self->can($method) ? : 6 0 6
ref $params eq 'ARRAY' ? : 0 6 6
Condition0%0/3
$^W and Carp::carp("Unrecognized parameter '${method}' in new()")
!ll&&!rl&&r
000
MC/DC0%0/2
$^W and Carp::carp("Unrecognized parameter '${method}' in new()")
$^W Carp::carp("Unrecognized parameter '${method}' in new()")
Truth table0%0/3
A and B
A= $^WB= Carp::carp("Unrecognized parameter '${method}' in new()")
ABresult
0X0
100
111
3651 ? $self->$method(ref $params eq 'ARRAY' ? @$params : $params)
3652 : $^W && Carp::carp "Unrecognized parameter '$method' in new()"
3653 }
3654  
3655 29 return $self;
3656 }
3657  
3658 sub init_context {
3659 19 ▶ my $self = shift->new;
Subroutine init_context: called CC=1 SCAR=0.0
Pod undocumented
3660 19 $self->{'_deserializer'}->{'_context'} = $self;
3661 # weaken circular reference to avoid a memory hole
3662 19 weaken $self->{'_deserializer'}->{'_context'};
3663  
3664 19 $self->{'_serializer'}->{'_context'} = $self;
3665 # weaken circular reference to avoid a memory hole
3666 19 weaken $self->{'_serializer'}->{'_context'};
3667 }
3668  
3669 # Naming? wsdl_parser
3670 sub schema {
3671 2 ▶ my $self = shift;
Subroutine schema: called CC=3 SCAR=11.6
Pod undocumented
3672 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 2 2
3673 0 $self->{'_schema'} = shift;
3674 0 return $self;
3675 }
3676 else {
3677 2 ▶ if (!defined $self->{'_schema'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_schema"}) 1 1 2
3678 1 $self->{'_schema'} = SOAP::Schema->new;
3679 }
3680 2 return $self->{'_schema'};
3681 }
3682 }
3683  
3684 sub BEGIN {
3685 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
3686 43 ▶ for my $method (qw(serializer deserializer)) {
Subroutine BEGIN: called CC=6 SCAR=18.5
3687 86 my $field = '_' . $method;
3688 *$method = sub {
3689 81 ▶ my $self = shift->new;
Subroutine __ANON__: called CC=2 SCAR=9.9
3690 81 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 81 81
3691 0 my $context = $self->{$field}->{'_context'}; # save the old context
3692 0 $self->{$field} = shift;
3693 0 $self->{$field}->{'_context'} = $context; # restore the old context
3694 0 return $self;
3695 }
3696 else {
3697 81 return $self->{$field};
3698 }
3699 }
3700 86 }
3701  
3702 __PACKAGE__->__mk_accessors(
3703 43 qw(endpoint transport outputxml autoresult packager)
3704 );
3705 # for my $method () {
3706 # my $field = '_' . $method;
3707 # *$method = sub {
3708 # my $self = shift->new;
3709 # @_ ? ($self->{$field} = shift, return $self) : return $self->{$field};
3710 # }
3711 # }
3712 43 for my $method (qw(on_action on_fault on_nonserialized)) {
3713 129 my $field = '_' . $method;
3714 *$method = sub {
3715 118 ▶ my $self = shift->new;
Subroutine __ANON__: called CC=4 SCAR=14.0
3716 118 ▶ return $self->{$field} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 73 45 118
3717 45 local $@;
3718 # commented out because that 'eval' was unsecure
3719 # > ref $_[0] eq 'CODE' ? shift : eval shift;
3720 # Am I paranoid enough?
3721 45 $self->{$field} = shift;
3722 45 ▶ Carp::croak $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 45 45
3723 Carp::croak "$method() expects subroutine (CODE) or string that evaluates into subroutine (CODE)"
3724 45 ▶ unless ref $self->{$field} eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self->{$field} eq "CODE" 0 45 45
3725 45 return $self;
3726 }
3727 129 }
3728 # SOAP::Transport Shortcuts
3729 # TODO - deprecate proxy() in favor of new language endpoint_url()
3730 43 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
3731 43 for my $method (qw(proxy)) {
3732 *$method = sub {
3733 50 ▶ my $self = shift->new;
Subroutine __ANON__: called CC=2 SCAR=6.9
3734 50 ▶ @_ ? ($self->transport->$method(@_), return $self) : return $self->transport->$method();
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 17 33 50
3735 }
3736 43 }
3737  
3738 # SOAP::Seriailizer Shortcuts
3739 43 for my $method (qw(autotype readable envprefix encodingStyle
3740 bodyattr headerattr
3741 encprefix multirefinplace encoding
3742 typelookup header maptype xmlschema
3743 uri ns_prefix ns_uri use_prefix use_default_ns
3744 ns default_ns)) {
3745 *$method = sub {
3746 16 ▶ my $self = shift->new;
Subroutine __ANON__: called CC=2 SCAR=6.9
3747 16 ▶ @_ ? ($self->serializer->$method(@_), return $self) : return $self->serializer->$method();
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 15 1 16
3748 }
3749 860 }
3750  
3751 # SOAP::Schema Shortcuts
3752 43 for my $method (qw(cache_dir cache_ttl)) {
3753 *$method = sub {
3754 0 ▶ my $self = shift->new;
Subroutine __ANON__: not called CC=2 SCAR=17.9
3755 0 ▶ @_ ? ($self->schema->$method(@_), return $self) : return $self->schema->$method();
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
3756 }
3757 86 }
3758 }
3759  
3760 sub parts {
3761 0 ▶ my $self = shift;
Subroutine parts: not called CC=1 SCAR=6.9
Pod documented
3762 0 $self->packager->parts(@_);
3763 0 return $self;
3764 }
3765  
3766 # Naming? wsdl
3767 sub service {
3768 1 ▶ my $self = shift->new;
Subroutine service: called CC=3 SCAR=11.1
Pod documented
3769 1 ▶ return $self->{'_service'} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 1 1
3770 1 $self->schema->schema_url($self->{'_service'} = shift);
3771 1 my %services = %{$self->schema->parse(@_)->load->services};
3772  
3773 1 ▶ Carp::croak "More than one service in service description. Service and port names have to be specified\n"
Branch: 1 branch
BranchTrueFalseTotal
if keys %services > 1 0 1 1
3774 if keys %services > 1;
3775 1 my $service = (keys %services)[0]->new;
3776 1 return $service;
3777 }
3778  
3779 sub AUTOLOAD {
3780 13 ▶ my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2);
Subroutine AUTOLOAD: called CC=3 SCAR=11.9
3781 13 ▶ return if $method eq 'DESTROY';
Branch: 1 branch
BranchTrueFalseTotal
if $method eq "DESTROY" 0 13 13
3782  
3783 13 ▶ ref $_[0] or Carp::croak qq!Can\'t locate class method "$method" via package \"! . __PACKAGE__ .'\"';
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] or Carp::croak(qq[Can't locate class method "$method" via package "] . 'SOAP::Lite' . "\\\"") 0 13 13
3784  
3785 43 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
3786 *$AUTOLOAD = sub {
3787 13 ▶ my $self = shift;
Subroutine __ANON__: called CC=4 SCAR=17.9
3788 13 my $som = $self->call($method => @_);
3789 12 ▶ return $self->autoresult && UNIVERSAL::isa($som => 'SOAP::SOM')
Branch: 2 branches
BranchTrueFalseTotal
$self->autoresult && UNIVERSAL::isa($som, 'SOAP::SOM') ? : 0 12 12
wantarray ? : 0 0 0
Condition33%1/3
$self->autoresult and UNIVERSAL::isa($som, "SOAP::SOM")
!ll&&!rl&&r
1200
MC/DC0%0/2
$self->autoresult and UNIVERSAL::isa($som, "SOAP::SOM")
$self->autoresult UNIVERSAL::isa($som, "SOAP::SOM")
Truth table33%1/3
A and B
A= $self->autoresultB= UNIVERSAL::isa($som, "SOAP::SOM")
ABresult
0X0
100
111
3790 ? wantarray ? $som->paramsall : $som->result
3791 : $som;
3792 13 };
3793 13 goto &$AUTOLOAD;
3794 }
3795  
3796 sub call {
3797 17 ▶ SOAP::Trace::trace('()');
Subroutine call: called CC=25 SCAR=47.7
Pod documented
3798 17 my $self = shift;
3799  
3800 17 ▶ die "A service address has not been specified either by using SOAP::Lite->proxy() or a service description)\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->proxy and UNIVERSAL::isa($self->proxy, "SOAP::Client") 1 16 17
Condition66%2/3
defined $self->proxy and UNIVERSAL::isa($self->proxy, "SOAP::Client")
!ll&&!rl&&r
1016
MC/DC50%1/2
defined $self->proxy and UNIVERSAL::isa($self->proxy, "SOAP::Client")
defined $self->proxy UNIVERSAL::isa($self->proxy, "SOAP::Client")
Truth table66%2/3
A and B
A= defined $self->proxyB= UNIVERSAL::isa($self->proxy, "SOAP::Client")
ABresult
0X0
100
111
3801 unless defined $self->proxy && UNIVERSAL::isa($self->proxy => 'SOAP::Client');
3802  
3803 16 $self->init_context();
3804  
3805 16 my $serializer = $self->serializer;
3806 16 $serializer->on_nonserialized($self->on_nonserialized);
3807  
3808 my $response = $self->transport->send_receive(
3809 context => $self, # this is provided for context
3810 endpoint => $self->endpoint,
3811 action => scalar($self->on_action->($serializer->uriformethod($_[0]))),
3812 # leave only parameters so we can later update them if required
3813 envelope => $serializer->envelope(method => shift, @_),
3814 encoding => $serializer->encoding,
3815 16 ▶ parts => @{$self->packager->parts} ? $self->packager->parts : undef,
Branch: 1 branch
BranchTrueFalseTotal
@{$self->packager->parts;} ? : 0 16 16
3816 );
3817  
3818 16 ▶ return $response if $self->outputxml;
Branch: 1 branch
BranchTrueFalseTotal
if $self->outputxml 0 16 16
3819  
3820 16 ▶ my $result = eval { $self->deserializer->deserialize($response) }
Branch: 1 branch
BranchTrueFalseTotal
if $response 16 0 16
3821 if $response;
3822  
3823 16 ▶ if (!$self->transport->is_success || # transport fault
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->transport->is_success or $@ or UNIVERSAL::isa($result, "SOAP::SOM") and $result->fault) 0 4 4
Condition55%5/9
not $self->transport->is_success or $@ or UNIVERSAL::isa($result, "SOAP::SOM") and $result->fault
l!l&&r!l&&!r
1204
not $self->transport->is_success or $@
l!l&&r!l&&!r
1204
UNIVERSAL::isa($result, "SOAP::SOM") and $result->fault
!ll&&!rl&&r
040
MC/DC25%1/4
not $self->transport->is_success or $@ or UNIVERSAL::isa($result, "SOAP::SOM") and $result->fault
not $self->transport->is_success $@ UNIVERSAL::isa($result, "SOAP::SOM") $result->fault
Truth table40%2/5
not(A) or B or C and D
A= not $self->transport->is_successB= $@C= UNIVERSAL::isa($result, "SOAP::SOM")D= $result->fault
ABCDresult
1XXX1
01XX1
00111
000X0
00100
3824 $@ || # not deserializible
3825 # fault message even if transport OK
3826 # or no transport error (for example, fo TCP, POP3, IO implementations)
3827 UNIVERSAL::isa($result => 'SOAP::SOM') && $result->fault) {
3828 12 ▶ return ($self->on_fault->($self, $@
Branch: 1 branch
BranchTrueFalseTotal
$@ ? : 11 1 12
Condition60%3/5
$self->on_fault->($self, $@ ? $@ . ($response || '') : $result) || $result
l!l&&r!l&&!r
1011
$response || ''
l!l
110
MC/DC50%1/2
$self->on_fault->($self, $@ ? $@ . ($response || '') : $result) || $result
$self->on_fault->($self, $@ ? $@ . ($response || '') : $result) $result
MC/DC0%0/1
$response || ''
$response
Truth table66%2/3
A || B
A= $self->on_fault->($self, $@ ? $@ . ($response || '') : $result)B= $result
ABresult
1X1
011
000
Truth table50%1/2
A
A= $response
Aresult
11
00
3829 ? $@ . ($response || '')
3830 : $result)
3831 || $result
3832 );
3833 # ? # trick editors
3834 }
3835 # this might be trouble for connection close...
3836 4 ▶ return unless $response; # nothing to do for one-ways
Branch: 1 branch
BranchTrueFalseTotal
unless $response 0 4 4
3837  
3838 # little bit tricky part that binds in/out parameters
3839 4 ▶ if (UNIVERSAL::isa($result => 'SOAP::SOM')
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::isa($result, "SOAP::SOM") and $result->paramsout || $result->headers and $serializer->signature) 0 4 4
Condition33%3/9
UNIVERSAL::isa($result, "SOAP::SOM") and $result->paramsout || $result->headers and $serializer->signature
!ll&&!rl&&r
400
UNIVERSAL::isa($result, "SOAP::SOM") and $result->paramsout || $result->headers
!ll&&!rl&&r
040
$result->paramsout or $result->headers
l!l&&r!l&&!r
004
MC/DC0%0/4
UNIVERSAL::isa($result, "SOAP::SOM") and $result->paramsout || $result->headers and $serializer->signature
UNIVERSAL::isa($result, "SOAP::SOM") $result->paramsout $result->headers $serializer->signature
Truth table16%1/6
A and B or C and D
A= UNIVERSAL::isa($result, "SOAP::SOM")B= $result->paramsoutC= $result->headersD= $serializer->signature
ABCDresult
0XXX0
100X0
11X00
10100
11X11
10111
3840 && ($result->paramsout || $result->headers)
3841 && $serializer->signature) {
3842 0 my $num = 0;
3843 0 my %signatures = map {$_ => $num++} @{$serializer->signature};
3844 0 for ($result->dataof(SOAP::SOM::paramsout), $result->dataof(SOAP::SOM::headers)) {
3845 0 ▶ my $signature = join $;, $_->name, $_->type || '';
Condition0%0/2
$_->type || ''
l!l
00
MC/DC0%0/1
$_->type || ''
$_->type
Truth table0%0/2
A
A= $_->type
Aresult
11
00
3846 0 ▶ if (exists $signatures{$signature}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $signatures{$signature}) 0 0 0
3847 0 my $param = $signatures{$signature};
3848 0 my($value) = $_->value; # take first value
3849  
3850 # fillup parameters
3851 UNIVERSAL::isa($_[$param] => 'SOAP::Data')
3852 ? $_[$param]->SOAP::Data::value($value)
3853 : UNIVERSAL::isa($_[$param] => 'ARRAY')
3854 0 ▶ ? (@{$_[$param]} = @$value)
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($_[$param], 'HASH') ? : 0 0 0
3855 : UNIVERSAL::isa($_[$param] => 'HASH')
3856 0 ▶ ? (%{$_[$param]} = %$value)
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($_[$param], 'SCALAR') ? : 0 0 0
3857 : UNIVERSAL::isa($_[$param] => 'SCALAR')
3858 0 ▶ ? (${$_[$param]} = $$value)
Branch: 2 branches
BranchTrueFalseTotal
UNIVERSAL::isa($_[$param], 'SOAP::Data') ? : 0 0 0
UNIVERSAL::isa($_[$param], 'ARRAY') ? : 0 0 0
3859 : ($_[$param] = $value)
3860 }
3861 }
3862 }
3863 4 return $result;
3864 } # end of call()
3865  
3866 # ======================================================================
3867  
3868 package SOAP::Lite::COM;
3869  
3870 43 require SOAP::Lite;
3871  
3872 sub required {
3873 0 ▶ foreach (qw(
Subroutine required: not called CC=2 SCAR=17.9
3874 URI::_foreign URI::http URI::https
3875 LWP::Protocol::http LWP::Protocol::https LWP::Authen::Basic LWP::Authen::Digest
3876 HTTP::Daemon Compress::Zlib SOAP::Transport::HTTP
3877 XMLRPC::Lite XMLRPC::Transport::HTTP
3878 )) {
3879 0 eval join ';', 'local $SIG{__DIE__}', "require $_";
3880 }
3881 }
3882  
3883 0 ▶sub new { required; SOAP::Lite->new(@_) }
Subroutine new: not called CC=1 SCAR=6.9
3884  
3885 43 sub create; *create = \&new; # make alias. Somewhere 'new' is registered keyword
3886  
3887 43 sub soap; *soap = \&new; # also alias. Just to be consistent with .xmlrpc call
3888  
3889 0 ▶sub xmlrpc { required; XMLRPC::Lite->new(@_) }
Subroutine xmlrpc: not called CC=1 SCAR=6.9
3890  
3891 0 ▶sub server { required; shift->new(@_) }
Subroutine server: not called CC=1 SCAR=6.9
3892  
3893 0 ▶sub data { SOAP::Data->new(@_) }
Subroutine data: not called CC=1 SCAR=6.9
3894  
3895 0 ▶sub header { SOAP::Header->new(@_) }
Subroutine header: not called CC=1 SCAR=6.9
3896  
3897 0 ▶sub hash { +{@_} }
Subroutine hash: not called CC=1 SCAR=6.9
3898  
3899 sub instanceof {
3900 0 ▶ my $class = shift;
Subroutine instanceof: not called CC=2 SCAR=17.9
3901 0 ▶ die "Incorrect class name" unless $class =~ /^(\w[\w:]*)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $class =~ /^(\w[\w:]*)$/ 0 0 0
3902 0 eval "require $class";
3903 0 $class->new(@_);
3904 }
3905  
3906 # ======================================================================
3907  
3908 43 1;
3909  
3910 __END__
« lib/SOAP/Lite/Packager.pm ↑ Summary lib/SOAP/Transport/TCP.pm »