blib/lib/XML/Pastor/Schema/Model.pm

filter: Statementstmt 89.6% 311 / 347 Branchbran 61.6% 127 / 206 Conditioncond 51.7% 59 / 114 MC/DCmcdc 28.1% 18 / 64 Subroutinesub 92.3% 24 / 26 Podpod 55.5% 5 / 9 totaltotal 71.0% 544 / 766 CC 154 SCAR 33.8
CC
154
Cov
75%
_resolveObjectClass
71.1
add
52.7
getItem
30.0
CRAP 29.4
« blib/lib/XML/Pastor/Builtin/Union.pm ↑ Summary blib/lib/XML/Pastor/Util.pm »
1
2 package XML::Pastor::Schema::Model;
3 10 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶no warnings qw(uninitialized);
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 10 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 ▶use Class::Accessor;
Subroutine BEGIN: called CC=1 SCAR=0.0
10
11 10 ▶use XML::Pastor::Schema::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 10 ▶use XML::Pastor::Schema::NamespaceInfo;
Subroutine BEGIN: called CC=1 SCAR=0.0
13
14 10 ▶use XML::Pastor::Util qw(mergeHash);
Subroutine BEGIN: called CC=1 SCAR=0.0
15
16 10 our @ISA = qw(Class::Accessor);
17
18 10 XML::Pastor::Schema::Model->mk_accessors( qw(type element group attribute attributeGroup defaultNamespace namespaces namespaceCounter));
19
20 9 ▶sub new {
Subroutine new: called CC=9 SCAR=23.4
Pod documented
21 9 my $proto = shift;
22 9 ▶ my $class = ref($proto) || $proto;
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
090
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
23 9 my $self = {@_};
24
25 9 ▶ unless ($self->{type}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"type"}) 9 0 9
26 9 $self->{type} = {};
27 }
28 9 ▶ unless ($self->{element}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"element"}) 9 0 9
29 9 $self->{element} = {};
30 }
31
32 9 ▶ unless ($self->{group}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"group"}) 9 0 9
33 9 $self->{group} = {};
34 }
35
36 9 ▶ unless ($self->{attribute}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"attribute"}) 9 0 9
37 9 $self->{attribute} = {};
38 }
39
40 9 ▶ unless ($self->{attributeGroup}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"attributeGroup"}) 9 0 9
41 9 $self->{attributeGroup} = {};
42 }
43
44 9 ▶ unless ($self->{namespaces}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"namespaces"}) 9 0 9
45 9 $self->{namespaces} = {};
46 }
47
48 9 ▶ unless ($self->{namespaceCounter}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"namespaceCounter"}) 9 0 9
49 9 $self->{namespaceCounter} = 0
50 }
51
52 9 return bless $self, $class;
53 }
54
55 #-------------------------------------------------------
56 1 ▶sub xml_item {
Subroutine xml_item: called CC=9 SCAR=24.0
Pod documented
57 1 my $self = shift;
58 1 my $name = shift;
59 1 my $nsUri = shift;
60 1 my $verbose = 0;
61
62 1 ▶ if (!$nsUri && $self->defaultNamespace) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $nsUri and $self->defaultNamespace) 1 0 1
Condition33%1/3
not $nsUri and $self->defaultNamespace
!ll&&!rl&&r
001
MC/DC0%0/2
not $nsUri and $self->defaultNamespace
not $nsUri $self->defaultNamespace
Truth table33%1/3
not(A) and B
A= not $nsUriB= $self->defaultNamespace
ABresult
0X0
100
111
63 1 $nsUri = $self->defaultNamespace()->uri();
64 }
65
66 1 ▶ my $key = $nsUri ? "$name|$nsUri" : $name;
Branch: 1 branch
BranchTrueFalseTotal
$nsUri ? : 1 0 1
67
68 1 ▶ print STDERR "Model item: name = '$name', key = '$key'\n" if ($verbose >= 9);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 9 0 1 1
69 1 my $item;
70 1 foreach my $hname (qw(element type group attribute attributeGroup)) {
71 1 my $items = $self->{$hname};
72 1 $item = $items->{$key};
73 1 ▶ last if defined($item);
Branch: 1 branch
BranchTrueFalseTotal
if defined $item 1 0 1
74 }
75
76 1 ▶ print STDERR "Found item: name = '$name'\n" if (defined ($item) && ($verbose >= 9));
Branch: 1 branch
BranchTrueFalseTotal
if defined $item and $verbose >= 9 0 1 1
Condition33%1/3
defined $item and $verbose >= 9
!ll&&!rl&&r
010
MC/DC0%0/2
defined $item and $verbose >= 9
defined $item $verbose >= 9
Truth table33%1/3
A and B
A= defined $itemB= $verbose >= 9
ABresult
0X0
100
111
77
78 1 return $item;
79
80 }
81
82 #-------------------------------------------------------
83 1 ▶sub xml_item_class {
Subroutine xml_item_class: called CC=4 SCAR=17.9
Pod documented
84 1 my $self = shift;
85 1 my $item = $self->xml_item(@_);
86
87 1 ▶ return undef unless (defined($item));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $item 0 1 1
88 1 ▶ return $item->class || ($item->definition && $item->definition->class);
Condition16%1/6
$item->class || $item->definition && $item->definition->class
l!l&&r!l&&!r
100
$item->definition and $item->definition->class
!ll&&!rl&&r
000
MC/DC0%0/3
$item->class || $item->definition && $item->definition->class
$item->class $item->definition $item->definition->class
Truth table25%1/4
A || B and C
A= $item->classB= $item->definitionC= $item->definition->class
ABCresult
1XX1
0111
00X0
0100
89 }
90
91 #-------------------------------------------------------
92 151 ▶sub add {
Subroutine add: called CC=20 SCAR=39.7
Pod documented
93 151 my $self = shift;
94 151 my $args = {@_};
95 151 my $field;
96 my $newItem;
97
98
99 151 ▶ unless (defined($field)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $field) 151 0 151
100 151 ▶ $newItem = $args->{object} || $args->{item} || $args->{node};
Condition33%2/6
$args->{'object'} || $args->{'item'} || $args->{'node'}
l!l&&r!l&&!r
15100
$args->{"object"} or $args->{"item"}
l!l&&r!l&&!r
15100
MC/DC0%0/3
$args->{'object'} || $args->{'item'} || $args->{'node'}
$args->{"object"} $args->{"item"} $args->{'node'}
Truth table25%1/4
A or B || C
A= $args->{"object"}B= $args->{"item"}C= $args->{'node'}
ABCresult
1XX1
01X1
0011
0000
101 SWITCH: {
102 151 ▶ UNIVERSAL::isa($newItem, "XML::Pastor::Schema::Type") and do {$field="type"; last SWITCH;};
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($newItem, "XML::Pastor::Schema::Type") and do { $field = "type"; last SWITCH } 108 43 151
103 43 ▶ UNIVERSAL::isa($newItem, "XML::Pastor::Schema::Element") and do {$field="element"; last SWITCH;};
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($newItem, "XML::Pastor::Schema::Element") and do { $field = "element"; last SWITCH } 41 2 43
104 2 ▶ UNIVERSAL::isa($newItem, "XML::Pastor::Schema::Group") and do {$field="group"; last SWITCH;};
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($newItem, "XML::Pastor::Schema::Group") and do { $field = "group"; last SWITCH } 1 1 2
105 0 ▶ UNIVERSAL::isa($newItem, "XML::Pastor::Schema::Attribute") and do {$field="attribute"; last SWITCH;};
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($newItem, "XML::Pastor::Schema::Attribute") and do { $field = "attribute"; last SWITCH } 0 1 1
106 1 ▶ UNIVERSAL::isa($newItem, "XML::Pastor::Schema::AttributeGroup") and do {$field="attributeGroup"; last SWITCH;};
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($newItem, "XML::Pastor::Schema::AttributeGroup") and do { $field = "attributeGroup"; last SWITCH } 1 0 1
107 }
108 }
109
110 151 ▶ unless (defined($field)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $field) 0 151 151
111 0 foreach my $arg (qw(type element group attribute attributeGroup)) {
112 0 ▶ if (defined ($args->{$arg})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args->{$arg}) 0 0 0
113 0 $field = $arg;
114 0 $newItem = $args->{$field};
115 0 last;
116 }
117 }
118 }
119
120
121 151 ▶ unless ( defined($field) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $field) 0 151 151
122 0 return undef;
123 }
124
125 151 my $items = $self->{$field};
126 151 ▶ my $key = UNIVERSAL::can($newItem, "key") ? $newItem->key() : (UNIVERSAL::can($newItem, "name") ? $newItem->name : '_anonymous_');
Branch: 2 branches
BranchTrueFalseTotal
UNIVERSAL::can($newItem, 'key') ? : 151 0 151
UNIVERSAL::can($newItem, 'name') ? : 0 0 0
127 151 ▶ if (defined(my $oldItem=$items->{$key})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $oldItem = $items->{$key})) 0 151 151
128 0 ▶ unless (UNIVERSAL::can($oldItem, 'isRedefinable') && $oldItem->isRedefinable() ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (UNIVERSAL::can($oldItem, "isRedefinable") and $oldItem->isRedefinable) 0 0 0
Condition0%0/3
UNIVERSAL::can($oldItem, "isRedefinable") and $oldItem->isRedefinable
!ll&&!rl&&r
000
MC/DC0%0/2
UNIVERSAL::can($oldItem, "isRedefinable") and $oldItem->isRedefinable
UNIVERSAL::can($oldItem, "isRedefinable") $oldItem->isRedefinable
Truth table0%0/3
A and B
A= UNIVERSAL::can($oldItem, "isRedefinable")B= $oldItem->isRedefinable
ABresult
0X0
100
111
129 0 die "Pastor : $field already defined : '$key'\\n";
130 }
131 }
132 151 ▶ $newItem->isRedefinable(1) if ($args->{operation} !~ /redefine/i) && UNIVERSAL::can($newItem, 'isRedefinable');
Branch: 1 branch
BranchTrueFalseTotal
if not $args->{"operation"} =~ /redefine/i and UNIVERSAL::can($newItem, "isRedefinable") 151 0 151
Condition33%1/3
not $args->{"operation"} =~ /redefine/i and UNIVERSAL::can($newItem, "isRedefinable")
!ll&&!rl&&r
00151
MC/DC0%0/2
not $args->{"operation"} =~ /redefine/i and UNIVERSAL::can($newItem, "isRedefinable")
not $args->{"operation"} =~ /redefine/i UNIVERSAL::can($newItem, "isRedefinable")
Truth table33%1/3
not(A) and B
A= not $args->{"operation"} =~ /redefine/iB= UNIVERSAL::can($newItem, "isRedefinable")
ABresult
0X0
100
111
133 151 $items->{$key} = $newItem;
134
135 }
136
137 #-------------------------------------------------------
138 24 ▶sub addNamespaceUri {
Subroutine addNamespaceUri: called CC=7 SCAR=19.5
Pod undocumented
139 24 my $self = shift;
140 24 my $uri = shift;
141 24 ▶ my $verbose = $self->{verbose} || 0;
Condition50%1/2
$self->{'verbose'} || 0
l!l
024
MC/DC0%0/1
$self->{'verbose'} || 0
$self->{'verbose'}
Truth table50%1/2
A
A= $self->{'verbose'}
Aresult
11
00
142
143 24 ▶ return undef unless(defined($uri));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $uri 0 24 24
144
145 24 my $nsh = $self->namespaces();
146
147 24 ▶ print STDERR "*** Adding Namespace URI to the schema model => '$uri'\n" if ($verbose >= 5);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 5 0 24 24
148
149 24 ▶ if (exists ($nsh->{$uri})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $nsh->{$uri}) { } 13 11 24
150 # URI is already in use
151 13 my $ns = $nsh->{$uri};
152 13 $ns->usageCount($ns->usageCount+1);
153 13 return $ns;
154 }else {
155 # URI is not already there
156 11 my $nsPfx = undef;
157 11 my $classPfx = undef;
158 11 my $id = 0;
159
160 # The counter serves for id purposes.
161 11 my $nsc = $self->namespaceCounter();
162
163 11 ▶ if ($nsc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nsc) 2 9 11
164 # There is at least one other target namespace alreday in there
165 2 $id = $nsc+1;
166 2 $nsPfx = "ns" . sprintf("%03d", $id);
167 2 $classPfx = $nsPfx;
168 }
169
170
171 # Add the URI to the namspace hash
172 11 my $ns = XML::Pastor::Schema::NamespaceInfo->new(uri=> $uri, id => $id, usageCount=>1, nsPrefix => $nsPfx, classPrefix => $classPfx);
173 11 $nsh->{$uri} = $ns;
174
175 # This is the first namespace that is declared. Make it the default.
176 11 ▶ unless ($nsc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($nsc) 9 2 11
177 9 $self->defaultNamespace($ns);
178 }
179
180 # Increment the id counter
181 11 $self->namespaceCounter( $self->namespaceCounter + 1);
182
183 11 return $ns;
184 }
185
186
187 }
188
189 #-------------------------------------------------------
190 0 ▶sub getItem {
Subroutine getItem: not called CC=5 SCAR=34.0
Pod undocumented
191 0 my $self = shift;
192 0 my $args = {@_};
193 0 my $field;
194 my $itemName;
195
196 0 ▶ unless (defined($field)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $field) 0 0 0
197 0 foreach my $arg (qw(type element group attribute attributeGroup)) {
198 0 ▶ if (defined ($args->{$arg})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args->{$arg}) 0 0 0
199 0 $field = $arg;
200 0 $itemName = $args->{$field};
201 0 last;
202 }
203 }
204 }
205
206 0 ▶ unless ( defined($field) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $field) 0 0 0
207 0 return undef;
208 }
209
210 0 my $items = $self->{$field};
211 0 return $items->{$itemName};
212 }
213
214 #------------------------------------------------------------------
215 0 ▶sub dump {
Subroutine dump: not called CC=1 SCAR=6.9
Pod undocumented
216 0 my $self = shift;
217 0 my $d = Data::Dumper->new([$self]);
218 0 $d->Sortkeys(1);
219
220 # $d->Deepcopy(1);
221 # $d->Terse(1);
222 0 return $d->Dump();
223 }
224
225 #------------------------------------------------------------------
226 9 ▶sub resolve {
Subroutine resolve: called CC=3 SCAR=11.3
Pod documented
227 9 my $self = shift;
228 9 my $opts = {@_};
229 9 ▶ my $verbose = $opts->{verbose} || 0;
Condition50%1/2
$opts->{'verbose'} || 0
l!l
09
MC/DC0%0/1
$opts->{'verbose'} || 0
$opts->{'verbose'}
Truth table50%1/2
A
A= $opts->{'verbose'}
Aresult
11
00
230
231 9 ▶ print "\n==== Resolving schema model ... ====\n" if ($verbose >= 3);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 3 0 9 9
232
233 9 $self->_resolve($opts);
234 }
235
236 #------------------------------------------------------------------
237 9 ▶sub _resolve {
Subroutine _resolve: called CC=3 SCAR=11.0
238 9 my $self = shift;
239 9 my $opts = shift;
240 9 my $hashList = [$self->group(), $self->attributeGroup, $self->type(), $self->element()];
241
242 9 foreach my $items (@$hashList) {
243 36 foreach my $name (sort keys %$items) {
244 151 $self->_resolveObject($items->{$name}, $opts);
245
246 }
247 }
248 }
249
250 #------------------------------------------------------------------
251 397 ▶sub _resolveObject {
Subroutine _resolveObject: called CC=3 SCAR=11.0
252 397 my $self = shift;
253 397 my $object = shift;
254 397 my $opts = shift;
255 397 ▶ my $verbose = $opts->{verbose} || 0;
Condition50%1/2
$opts->{'verbose'} || 0
l!l
0397
MC/DC0%0/1
$opts->{'verbose'} || 0
$opts->{'verbose'}
Truth table50%1/2
A
A= $opts->{'verbose'}
Aresult
11
00
256
257 397 $self->_resolveObjectRef($object, $opts);
258 397 ▶ $self->_resolveObject($object->definition(), $opts) if ($object->definition());
Branch: 1 branch
BranchTrueFalseTotal
if $object->definition 40 357 397
259
260 397 $self->_resolveObjectAttributes($object, $opts);
261 397 $self->_resolveObjectElements($object, $opts);
262
263 397 $self->_resolveObjectClass($object, $opts);
264 397 $self->_resolveObjectBase($object, $opts);
265
266 397 return $object;
267 }
268
269 #------------------------------------------------------------------
270 397 ▶sub _resolveObjectRef {
Subroutine _resolveObjectRef: called CC=12 SCAR=26.2
271 397 my $self = shift;
272 397 my $object = shift;
273 397 my $opts = shift;
274 397 ▶ my $verbose = $opts->{verbose} || 0;
Condition50%1/2
$opts->{'verbose'} || 0
l!l
0397
MC/DC0%0/1
$opts->{'verbose'} || 0
$opts->{'verbose'}
Truth table50%1/2
A
A= $opts->{'verbose'}
Aresult
11
00
275
276 397 ▶ return $object unless ( UNIVERSAL::can($object, "ref") && $object->ref() );
Branch: 1 branch
BranchTrueFalseTotal
unless UNIVERSAL::can($object, "ref") and $object->ref 357 40 397
Condition66%2/3
UNIVERSAL::can($object, "ref") and $object->ref
!ll&&!rl&&r
035740
MC/DC50%1/2
UNIVERSAL::can($object, "ref") and $object->ref
UNIVERSAL::can($object, "ref") $object->ref
Truth table66%2/3
A and B
A= UNIVERSAL::can($object, "ref")B= $object->ref
ABresult
0X0
100
111
277
278 40 ▶ print STDERR " Resolving REFERENCES for object '" . $object->name . "' ...\n" if ($verbose >= 6);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 6 0 40 40
279
280 40 my $field = undef;
281
282 SWITCH: {
283 0 ▶ UNIVERSAL::isa($object, "XML::Pastor::Schema::Type") and do {$field="type"; last SWITCH;};
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($object, "XML::Pastor::Schema::Type") and do { $field = "type"; last SWITCH } 0 40 40
284 40 ▶ UNIVERSAL::isa($object, "XML::Pastor::Schema::Element") and do {$field="element"; last SWITCH;};
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($object, "XML::Pastor::Schema::Element") and do { $field = "element"; last SWITCH } 38 2 40
285 2 ▶ UNIVERSAL::isa($object, "XML::Pastor::Schema::Group") and do {$field="group"; last SWITCH;};
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($object, "XML::Pastor::Schema::Group") and do { $field = "group"; last SWITCH } 1 1 2
286 0 ▶ UNIVERSAL::isa($object, "XML::Pastor::Schema::Attribute") and do {$field="attribute"; last SWITCH;};
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($object, "XML::Pastor::Schema::Attribute") and do { $field = "attribute"; last SWITCH } 0 1 1
287 1 ▶ UNIVERSAL::isa($object, "XML::Pastor::Schema::AttributeGroup") and do {$field="attributeGroup"; last SWITCH;};
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($object, "XML::Pastor::Schema::AttributeGroup") and do { $field = "attributeGroup"; last SWITCH } 1 0 1
288 }
289
290 40 ▶ print STDERR " Reference is $field\n" if ($verbose >=9);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 9 0 40 40
291
292 40 my $hash = $self->{$field};
293 40 my $refKey = $object->refKey;
294
295 40 ▶ print STDERR " Resolving reference for '$refKey'\n" if ($verbose >=9);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 9 0 40 40
296
297 40 my $def = $hash->{$refKey};
298 40 $object->definition($def);
299
300 40 return $def;
301 }
302
303
304 #------------------------------------------------------------------
305 397 ▶sub _resolveObjectClass {
Subroutine _resolveObjectClass: called CC=41 SCAR=42.6
306 397 my $self = shift;
307 397 my $object = shift;
308 397 my $opts = shift;
309 397 ▶ my $verbose = $opts->{verbose} || 0;
Condition50%1/2
$opts->{'verbose'} || 0
l!l
0397
MC/DC0%0/1
$opts->{'verbose'} || 0
$opts->{'verbose'}
Truth table50%1/2
A
A= $opts->{'verbose'}
Aresult
11
00
310 397 $opts->{object} = $object;
311
312 397 ▶ my $class_prefix = $opts->{class_prefix} || '';
Condition50%1/2
$opts->{'class_prefix'} || ''
l!l
3970
MC/DC0%0/1
$opts->{'class_prefix'} || ''
$opts->{'class_prefix'}
Truth table50%1/2
A
A= $opts->{'class_prefix'}
Aresult
11
00
313 397 ▶ while (($class_prefix) && ($class_prefix !~ /::$/)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class_prefix and not $class_prefix =~ /::$/) 666 397 1063
Condition66%2/3
$class_prefix and not $class_prefix =~ /::$/
!ll&&!rl&&r
0397666
MC/DC50%1/2
$class_prefix and not $class_prefix =~ /::$/
$class_prefix not $class_prefix =~ /::$/
Truth table66%2/3
A and not(B)
A= $class_prefixB= not $class_prefix =~ /::$/
ABresult
0X0
100
111
314 666 $class_prefix .= ':';
315 }
316
317 397 ▶ print STDERR " Resolving CLASS for object '" . $object->name . "' ... \n" if ($verbose >= 6);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 6 0 397 397
318
319 397 ▶ if (UNIVERSAL::can($object, "metaClass")) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($object, "metaClass")) 397 0 397
320 397 $object->metaClass($class_prefix . "Pastor::Meta");
321 }
322
323
324 397 ▶ if (UNIVERSAL::isa($object, "XML::Pastor::Schema::Type")) {
Branch: 3 branches
BranchTrueFalseTotal
if (UNIVERSAL::isa($object, 'XML::Pastor::Schema::Type')) { } 111 286 397
elsif (UNIVERSAL::isa($object, 'XML::Pastor::Schema::Element') and $object->scope =~ /global/) { } 79 207 286
elsif (UNIVERSAL::can($object, 'type') and UNIVERSAL::can($object, 'class')) { } 207 0 207
325 111 ▶ print " object '" . $object->name . "' is a Type. Resolving class...\n" if ($verbose >= 7);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 7 0 111 111
326 111 $object->class($self->_typeToClass($object->name(), $opts));
327 ▶ }elsif (UNIVERSAL::isa($object, "XML::Pastor::Schema::Element") && ($object->scope() =~ /global/)) {
Condition100%3/3
UNIVERSAL::isa($object, "XML::Pastor::Schema::Element") and $object->scope =~ /global/
!ll&&!rl&&r
1089979
MC/DC100%2/2
UNIVERSAL::isa($object, "XML::Pastor::Schema::Element") and $object->scope =~ /global/
UNIVERSAL::isa($object, "XML::Pastor::Schema::Element") $object->scope =~ /global/
Truth table100%3/3
A and B
A= UNIVERSAL::isa($object, "XML::Pastor::Schema::Element")B= $object->scope =~ /global/
ABresult
0X0
100
111
328 79 ▶ print " object '" . $object->name . "' is a global element. Resolving class...\n" if ($verbose >= 7);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 7 0 79 79
329 79 ▶ my $uri = UNIVERSAL::can($object, 'targetNamespace') ? $object->targetNamespace : "";
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::can($object, 'targetNamespace') ? : 79 0 79
330 79 ▶ my $pfx = $uri ? $self->namespaceClassPrefix($uri) : "";
Branch: 1 branch
BranchTrueFalseTotal
$uri ? : 40 39 79
331 79 $object->class($class_prefix. $pfx . $object->name());
332 ▶ }elsif(UNIVERSAL::can($object, "type") && UNIVERSAL::can($object, "class")) {
Condition33%1/3
UNIVERSAL::can($object, "type") and UNIVERSAL::can($object, "class")
!ll&&!rl&&r
00207
MC/DC0%0/2
UNIVERSAL::can($object, "type") and UNIVERSAL::can($object, "class")
UNIVERSAL::can($object, "type") UNIVERSAL::can($object, "class")
Truth table33%1/3
A and B
A= UNIVERSAL::can($object, "type")B= UNIVERSAL::can($object, "class")
ABresult
0X0
100
111
333 207 ▶ print " object '" . ($object->name || ''). "' 'can' type() and class(). TYPE='". ($object->type() || '') . "' CLASS='" . ($object->class() || '') . "' Resolving class...\n" if ($verbose >= 7);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 7 0 207 207
Condition0%0/6
$object->name || ''
l!l
00
$object->type || ''
l!l
00
$object->class || ''
l!l
00
MC/DC0%0/1
$object->name || ''
$object->name
MC/DC0%0/1
$object->type || ''
$object->type
MC/DC0%0/1
$object->class || ''
$object->class
Truth table0%0/2
A
A= $object->name
Aresult
11
00
Truth table0%0/2
A
A= $object->type
Aresult
11
00
Truth table0%0/2
A
A= $object->class
Aresult
11
00
334
335 207 $object->class($self->_typeToClass($object->type(), $opts));
336 }
337
338 397 ▶ if (UNIVERSAL::can($object, "itemType") && UNIVERSAL::can($object, "itemClass") && $object->itemType) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($object, "itemType") and UNIVERSAL::can($object, "itemClass") and $object->itemType) 6 391 397
Condition83%5/6
UNIVERSAL::can($object, "itemType") and UNIVERSAL::can($object, "itemClass") and $object->itemType
!ll&&!rl&&r
347446
UNIVERSAL::can($object, "itemType") and UNIVERSAL::can($object, "itemClass")
!ll&&!rl&&r
347050
MC/DC66%2/3
UNIVERSAL::can($object, "itemType") and UNIVERSAL::can($object, "itemClass") and $object->itemType
UNIVERSAL::can($object, "itemType") UNIVERSAL::can($object, "itemClass") $object->itemType
Truth table75%3/4
A and B and C
A= UNIVERSAL::can($object, "itemType")B= UNIVERSAL::can($object, "itemClass")C= $object->itemType
ABCresult
0XX0
10X0
1100
1111
339 6 ▶ print " object '" . $object->name . "' 'can' itemType() and itemClass(). Resolving class...\n" if ($verbose >= 7);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 7 0 6 6
340 6 $object->itemClass($self->_typeToClass($object->itemType, $opts));
341 }
342
343 397 ▶ if (UNIVERSAL::can($object, "memberTypes") && UNIVERSAL::can($object, "memberClasses") && $object->memberTypes) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($object, "memberTypes") and UNIVERSAL::can($object, "memberClasses") and $object->memberTypes) 12 385 397
Condition83%5/6
UNIVERSAL::can($object, "memberTypes") and UNIVERSAL::can($object, "memberClasses") and $object->memberTypes
!ll&&!rl&&r
3473812
UNIVERSAL::can($object, "memberTypes") and UNIVERSAL::can($object, "memberClasses")
!ll&&!rl&&r
347050
MC/DC66%2/3
UNIVERSAL::can($object, "memberTypes") and UNIVERSAL::can($object, "memberClasses") and $object->memberTypes
UNIVERSAL::can($object, "memberTypes") UNIVERSAL::can($object, "memberClasses") $object->memberTypes
Truth table75%3/4
A and B and C
A= UNIVERSAL::can($object, "memberTypes")B= UNIVERSAL::can($object, "memberClasses")C= $object->memberTypes
ABCresult
0XX0
10X0
1100
1111
344 12 ▶ print " object '" . $object->name . "' 'can' memberTypes() and memberClasses(). Resolving class...\n" if ($verbose >= 7);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 7 0 12 12
345 12 my @mbts = split ' ', $object->memberTypes;
346 12 $object->memberClasses([map {$self->_typeToClass($_, $opts);} @mbts]);
347 }
348
349
350 397 ▶ if (UNIVERSAL::can($object, "baseClasses")) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($object, "baseClasses")) 289 108 397
351 289 ▶ print " object '" . $object->name . "' 'can' baseClasses(). Resolving class...\n" if ($verbose >= 7);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 7 0 289 289
352
353 289 ▶ if (UNIVERSAL::can($object, "base") && $object->base()) {
Branch: 4 branches
BranchTrueFalseTotal
if (UNIVERSAL::can($object, 'base') and $object->base) { } 58 231 289
elsif (UNIVERSAL::isa($object, 'XML::Pastor::Schema::Element') and $object->type and $object->scope =~ /global/) { } 79 152 231
elsif (UNIVERSAL::isa($object, 'XML::Pastor::Schema::SimpleType')) { } 0 152 152
elsif (UNIVERSAL::isa($object, 'XML::Pastor::Schema::ComplexType')) { } 53 99 152
Condition100%3/3
UNIVERSAL::can($object, "base") and $object->base
!ll&&!rl&&r
1785358
MC/DC100%2/2
UNIVERSAL::can($object, "base") and $object->base
UNIVERSAL::can($object, "base") $object->base
Truth table100%3/3
A and B
A= UNIVERSAL::can($object, "base")B= $object->base
ABresult
0X0
100
111
354
355 58 $object->baseClasses([$self->_typeToClass($object->base(), $opts)]);
356 ▶ }elsif (UNIVERSAL::isa($object, "XML::Pastor::Schema::Element")
Condition83%5/6
UNIVERSAL::isa($object, "XML::Pastor::Schema::Element") and $object->type and $object->scope =~ /global/
!ll&&!rl&&r
539979
UNIVERSAL::isa($object, "XML::Pastor::Schema::Element") and $object->type
!ll&&!rl&&r
530178
MC/DC66%2/3
UNIVERSAL::isa($object, "XML::Pastor::Schema::Element") and $object->type and $object->scope =~ /global/
UNIVERSAL::isa($object, "XML::Pastor::Schema::Element") $object->type $object->scope =~ /global/
Truth table75%3/4
A and B and C
A= UNIVERSAL::isa($object, "XML::Pastor::Schema::Element")B= $object->typeC= $object->scope =~ /global/
ABCresult
0XX0
10X0
1100
1111
357 && $object->type() && ($object->scope() =~ /global/)){
358 79 $object->baseClasses([$self->_typeToClass($object->type(), $opts), "XML::Pastor::Element"]);
359 }elsif ( UNIVERSAL::isa($object, "XML::Pastor::Schema::SimpleType")) {
360 0 my $isa = $opts->{simple_isa};
361 0 ▶ $isa = ( (ref($isa) =~ /ARRAY/) ? $isa : ($isa ? [$isa] : []));
Branch: 2 branches
BranchTrueFalseTotal
ref($isa) =~ /ARRAY/ ? : 0 0 0
$isa ? : 0 0 0
362 0 $object->baseClasses([@$isa, "XML::Pastor::SimpleType"]);
363 }elsif ( UNIVERSAL::isa($object, "XML::Pastor::Schema::ComplexType")) {
364 53 my $isa = $opts->{complex_isa};
365 53 ▶ $isa = ( (ref($isa) =~ /ARRAY/) ? $isa : ($isa ? [$isa] : []));
Branch: 2 branches
BranchTrueFalseTotal
ref($isa) =~ /ARRAY/ ? : 0 53 53
$isa ? : 0 53 53
366 53 $object->baseClasses([@$isa, "XML::Pastor::ComplexType"]);
367 }
368 }
369
370
371 397 return $object;
372 }
373
374 #------------------------------------------------------------------
375 397 ▶sub _resolveObjectAttributes {
Subroutine _resolveObjectAttributes: called CC=10 SCAR=23.9
376 397 my $self = shift;
377 397 my $object = shift;
378 397 my $opts = shift;
379 397 ▶ my $verbose = $opts->{verbose} || 0;
Condition50%1/2
$opts->{'verbose'} || 0
l!l
0397
MC/DC0%0/1
$opts->{'verbose'} || 0
$opts->{'verbose'}
Truth table50%1/2
A
A= $opts->{'verbose'}
Aresult
11
00
380
381 397 ▶ return undef unless (UNIVERSAL::can($object, "attributes"));
Branch: 1 branch
BranchTrueFalseTotal
unless UNIVERSAL::can($object, "attributes") 333 64 397
382 64 ▶ print STDERR " Resolving ATTRIBUTES for object '" . $object->name . "' ...\n" if ($verbose >= 6);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 6 0 64 64
383
384 64 my $attributes = $object->attributes();
385 64 my $attribInfo = $object->attributeInfo();
386 64 my $newAttribs = [];
387
388 64 foreach my $attribName (@$attributes) {
389 103 my $attrib = $attribInfo->{$attribName};
390 103 $self->_resolveObject($attrib, $opts);
391
392 103 ▶ unless (UNIVERSAL::isa($attrib, "XML::Pastor::Schema::Attribute")) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::isa($attrib, 'XML::Pastor::Schema::Attribute')) { } 102 1 103
393 1 ▶ my $a= (UNIVERSAL::can($attrib, "definition") && $attrib->definition()) || $attrib;
Condition33%2/6
UNIVERSAL::can($attrib, 'definition') && $attrib->definition || $attrib
l!l&&r!l&&!r
100
UNIVERSAL::can($attrib, "definition") and $attrib->definition
!ll&&!rl&&r
001
MC/DC0%0/3
UNIVERSAL::can($attrib, 'definition') && $attrib->definition || $attrib
UNIVERSAL::can($attrib, "definition") $attrib->definition $attrib
Truth table20%1/5
A and B || C
A= UNIVERSAL::can($attrib, "definition")B= $attrib->definitionC= $attrib
ABCresult
11X1
0X11
1011
0X00
1000
394 1 ▶ push @$newAttribs, @{$a->attributes()} if UNIVERSAL::can($a, "attributes");
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::can($a, "attributes") 1 0 1
395 1 ▶ mergeHash($attribInfo,$a->attributeInfo()) if UNIVERSAL::can($a, "attributeInfo");
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::can($a, "attributeInfo") 1 0 1
396 }else {
397 102 push @$newAttribs, $attribName;
398 }
399 }
400
401 64 $object->attributes($newAttribs);
402 64 return $object;
403 }
404
405 #------------------------------------------------------------------
406 397 ▶sub _resolveObjectElements {
Subroutine _resolveObjectElements: called CC=10 SCAR=23.9
407 397 my $self = shift;
408 397 my $object = shift;
409 397 my $opts = shift;
410 397 ▶ my $verbose = $opts->{verbose} || 0;
Condition50%1/2
$opts->{'verbose'} || 0
l!l
0397
MC/DC0%0/1
$opts->{'verbose'} || 0
$opts->{'verbose'}
Truth table50%1/2
A
A= $opts->{'verbose'}
Aresult
11
00
411
412 397 ▶ return undef unless (UNIVERSAL::can($object, "elements"));
Branch: 1 branch
BranchTrueFalseTotal
unless UNIVERSAL::can($object, "elements") 333 64 397
413
414 64 ▶ print STDERR " Resolving ELEMENTS for object '" . $object->name . "' ...\n" if ($verbose >= 6);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 6 0 64 64
415
416 64 my $elements = $object->elements();
417 64 my $elemInfo = $object->elementInfo();
418 64 my $newElems = [];
419
420 64 foreach my $elemName (@$elements) {
421 100 my $elem = $elemInfo->{$elemName};
422 100 $self->_resolveObject($elem, $opts);
423
424 100 ▶ unless (UNIVERSAL::isa($elem, "XML::Pastor::Schema::Element")) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::isa($elem, 'XML::Pastor::Schema::Element')) { } 99 1 100
425 1 ▶ my $e= (UNIVERSAL::can($elem, "definition") && $elem->definition()) || $elem;
Condition33%2/6
UNIVERSAL::can($elem, 'definition') && $elem->definition || $elem
l!l&&r!l&&!r
100
UNIVERSAL::can($elem, "definition") and $elem->definition
!ll&&!rl&&r
001
MC/DC0%0/3
UNIVERSAL::can($elem, 'definition') && $elem->definition || $elem
UNIVERSAL::can($elem, "definition") $elem->definition $elem
Truth table20%1/5
A and B || C
A= UNIVERSAL::can($elem, "definition")B= $elem->definitionC= $elem
ABCresult
11X1
0X11
1011
0X00
1000
426 1 ▶ push @$newElems, @{$e->elements()} if UNIVERSAL::can($e, "elements");
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::can($e, "elements") 1 0 1
427 1 ▶ mergeHash($elemInfo,$e->elementInfo()) if UNIVERSAL::can($e, "elementInfo");
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::can($e, "elementInfo") 1 0 1
428 }else {
429 99 push @$newElems, $elemName;
430 }
431 }
432
433 64 $object->elements($newElems);
434 64 return $object;
435 }
436
437 #------------------------------------------------------------------
438 397 ▶sub _resolveObjectBase {
Subroutine _resolveObjectBase: called CC=13 SCAR=26.0
439 397 my $self = shift;
440 397 my $object = shift;
441 397 my $opts = shift;
442 397 ▶ my $verbose = $opts->{verbose} || 0;
Condition50%1/2
$opts->{'verbose'} || 0
l!l
0397
MC/DC0%0/1
$opts->{'verbose'} || 0
$opts->{'verbose'}
Truth table50%1/2
A
A= $opts->{'verbose'}
Aresult
11
00
443
444 397 ▶ return undef unless (UNIVERSAL::can($object, "base") && $object->base());
Branch: 1 branch
BranchTrueFalseTotal
unless UNIVERSAL::can($object, "base") and $object->base 339 58 397
Condition100%3/3
UNIVERSAL::can($object, "base") and $object->base
!ll&&!rl&&r
2865358
MC/DC100%2/2
UNIVERSAL::can($object, "base") and $object->base
UNIVERSAL::can($object, "base") $object->base
Truth table100%3/3
A and B
A= UNIVERSAL::can($object, "base")B= $object->base
ABresult
0X0
100
111
445 58 ▶ print STDERR " Resolving BASE for object '" . $object->name . "' ...\n" if ($verbose >= 6);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 6 0 58 58
446
447
448 58 my $base = $object->base();
449 58 my $types = $self->type();
450 58 my $baseType = $types->{$base};
451
452
453 58 ▶ return undef unless ($baseType);
Branch: 1 branch
BranchTrueFalseTotal
unless $baseType 55 3 58
454 3 $self->_resolveObject($baseType, $opts);
455
456
457 3 ▶ if (UNIVERSAL::can($object, "xAttributes")) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($object, "xAttributes")) 3 0 3
458 3 my $xattribs = [];
459 3 my $xattribInfo = {};
460
461 3 ▶ if (UNIVERSAL::can($baseType, "effectiveAttributes")) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($baseType, "effectiveAttributes")) 3 0 3
462 3 push @$xattribs, @{$baseType->effectiveAttributes()};
463 3 mergeHash ($xattribInfo, $baseType->effectiveAttributeInfo());
464 }
465
466 3 push @$xattribs, @{$object->attributes()};
467 3 mergeHash ($xattribInfo, $object->attributeInfo());
468
469 3 ▶ print ' ' . scalar(@$xattribs) . ' attributes. ' if ($verbose >=5);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 5 0 3 3
470
471 3 ▶ if (@$xattribs) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$xattribs) 3 0 3
472 3 $object->xAttributes($xattribs);
473 3 $object->xAttributeInfo($xattribInfo);
474 }
475 }
476
477 3 ▶ if (UNIVERSAL::can($object, "xElements")) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($object, "xElements")) 3 0 3
478 3 my $xelems = [];
479 3 my $xelemInfo = {};
480
481 3 ▶ if (UNIVERSAL::can($baseType, "effectiveElements")) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($baseType, "effectiveElements")) 3 0 3
482 3 push @$xelems, @{$baseType->effectiveElements()};
483 3 mergeHash ($xelemInfo, $baseType->effectiveElementInfo());
484 }
485
486 3 push @$xelems, @{$object->elements()};
487 3 mergeHash ($xelemInfo, $object->elementInfo());
488
489 # print ' ' . scalar(@$xelems) . ' elements. ';
490 3 ▶ if (@$xelems) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$xelems) 3 0 3
491 3 $object->xElements($xelems);
492 3 $object->xElementInfo($xelemInfo);
493 }
494 }
495
496 3 return $object;
497 }
498
499 #------------------------------------------------------------------
500 493 ▶sub _typeToClass {
Subroutine _typeToClass: called CC=15 SCAR=28.5
501 493 my $self = shift;
502 493 my $type = shift;
503 493 my $opts = shift;
504 493 my $object = $opts->{object};
505 493 ▶ my $isNonType = $opts->{isNonType} || 0;
Condition50%1/2
$opts->{'isNonType'} || 0
l!l
0493
MC/DC0%0/1
$opts->{'isNonType'} || 0
$opts->{'isNonType'}
Truth table50%1/2
A
A= $opts->{'isNonType'}
Aresult
11
00
506 493 ▶ my $typePfx = $isNonType ? "" : "Type::";
Branch: 1 branch
BranchTrueFalseTotal
$isNonType ? : 0 493 493
507 493 my $verbose = 0;
508
509 493 ▶ return undef unless (defined($type));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type 6 487 493
510
511 487 ▶ my $class_prefix = $opts->{class_prefix} || "";
Condition50%1/2
$opts->{'class_prefix'} || ''
l!l
4870
MC/DC0%0/1
$opts->{'class_prefix'} || ''
$opts->{'class_prefix'}
Truth table50%1/2
A
A= $opts->{'class_prefix'}
Aresult
11
00
512 487 ▶ while (($class_prefix) && ($class_prefix !~ /::$/)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class_prefix and not $class_prefix =~ /::$/) 846 487 1333
Condition66%2/3
$class_prefix and not $class_prefix =~ /::$/
!ll&&!rl&&r
0487846
MC/DC50%1/2
$class_prefix and not $class_prefix =~ /::$/
$class_prefix not $class_prefix =~ /::$/
Truth table66%2/3
A and not(B)
A= $class_prefixB= not $class_prefix =~ /::$/
ABresult
0X0
100
111
513 846 $class_prefix .= ':';
514 }
515
516 487 my $builtin_prefix = "XML::Pastor::Builtin::";
517 487 ▶ if (($type =~ /^Union$/i) || ($type =~ /^List$/i)) {
Branch: 4 branches
BranchTrueFalseTotal
if ($type =~ /^Union$/i or $type =~ /^List$/i) { } 0 487 487
elsif (not $type) { } 0 487 487
elsif ($type =~ m[www.w3.org/.*/XMLSchema$]) { } 154 333 487
elsif ($type =~ /\|/) { } 90 243 333
Condition33%1/3
$type =~ /^Union$/i or $type =~ /^List$/i
l!l&&r!l&&!r
00487
MC/DC0%0/2
$type =~ /^Union$/i or $type =~ /^List$/i
$type =~ /^Union$/i $type =~ /^List$/i
Truth table33%1/3
A or B
A= $type =~ /^Union$/iB= $type =~ /^List$/i
ABresult
1X1
011
000
518 # This one is put by the parser. So we don't have a URI for it.
519 0 return $builtin_prefix . ucfirst($type);
520 }elsif (!$type) {
521 # No type declaration, assume string
522 0 return $builtin_prefix . "string";
523 }elsif ($type =~ /www.w3.org\/.*\/XMLSchema$/) {
524 # Builtin type
525 154 my ($localType) = split /\|/, $type;
526 154 return $builtin_prefix . $localType;
527 }elsif ($type =~ /\|/) {
528 # Type with a namespace.
529 90 my ($localType, $uri) = split /\|/, $type;
530 90 my $pfx = $self->namespaceClassPrefix($uri);
531
532 90 my $retval = $class_prefix . $pfx . $typePfx . $localType; ;
533 90 ▶ print STDERR "_typeToClass: from '$type' to '$retval'\n" if ($verbose >=9);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 9 0 90 90
534
535 90 return $retval;
536 #die "Pastor: Namespaces not yet supported!\n";
537 }else {
538 # Regular type.
539 243 ▶ my $uri = UNIVERSAL::can($object, 'targetNamespace') ? $object->targetNamespace : "";
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::can($object, 'targetNamespace') ? : 243 0 243
540 243 ▶ my $pfx = $uri ? $self->namespaceClassPrefix($uri) : "";
Branch: 1 branch
BranchTrueFalseTotal
$uri ? : 90 153 243
541 243 return $class_prefix . $pfx . $typePfx . $type;
542 }
543 }
544
545
546 #-------------------------------------------------------
547 220 ▶sub namespaceClassPrefix {
Subroutine namespaceClassPrefix: called CC=5 SCAR=16.1
Pod undocumented
548 220 my $self = shift;
549 220 my $uri = shift;
550
551 220 my $ns = $self->namespaces->{$uri};
552 220 ▶ my $pfx = defined($ns) ? ($ns->classPrefix() || "") : "";
Branch: 1 branch
BranchTrueFalseTotal
defined $ns ? : 220 0 220
Condition100%2/2
$ns->classPrefix or ""
l!l
20200
MC/DC100%1/1
$ns->classPrefix or ""
$ns->classPrefix
Truth table100%2/2
A
A= $ns->classPrefix
Aresult
11
00
553 220 ▶ while (($pfx) && ($pfx !~ /::$/)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pfx and not $pfx =~ /::$/) 40 220 260
Condition100%3/3
$pfx and not $pfx =~ /::$/
!ll&&!rl&&r
2002040
MC/DC100%2/2
$pfx and not $pfx =~ /::$/
$pfx not $pfx =~ /::$/
Truth table100%3/3
A and not(B)
A= $pfxB= not $pfx =~ /::$/
ABresult
0X0
100
111
554 40 $pfx .= ':';
555 }
556
557 220 return $pfx;
558 }
559
560 10 1;
561
562 __END__
« blib/lib/XML/Pastor/Builtin/Union.pm ↑ Summary blib/lib/XML/Pastor/Util.pm »