blib/lib/XML/Pastor/Builtin/Union.pm

filter: Statementstmt 56.6% 17 / 30 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 100% 1 / 1 totaltotal 46.9% 23 / 49 CC 7 SCAR 35.0
CC
7
Cov
42%
xml_validate
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 33.1
« blib/lib/XML/Pastor/Pastorize.pm ↑ Summary blib/lib/XML/Pastor/Schema/Model.pm »
1 10 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶no warnings qw(uninitialized);
Subroutine BEGIN: called CC=1 SCAR=0.0
5
6
7 #======================================================================
8 package XML::Pastor::Builtin::Union;
9
10 10 ▶use XML::Pastor::Builtin::SimpleType;
Subroutine BEGIN: called CC=1 SCAR=0.0
11
12 10 our @ISA = qw(XML::Pastor::Builtin::SimpleType);
13
14 #--------------------------------------------------------------
15 0 ▶sub xml_validate {
Subroutine xml_validate: not called CC=7 SCAR=40.3
Pod documented
16 0 my $self = shift;
17 0 ▶ my $path = shift || '';
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
18 0 my $type = $self->XmlSchemaType();
19 0 my $value = $self->__value;
20 0 ▶ my $members = $type->memberClasses || [];
Condition0%0/2
$type->memberClasses || []
l!l
00
MC/DC0%0/1
$type->memberClasses || []
$type->memberClasses
Truth table0%0/2
A
A= $type->memberClasses
Aresult
11
00
21
22 0 ▶ unless (@$members) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@$members) 0 0 0
23 0 return 1;
24 }
25
26 0 foreach my $class (@$members) {
27 0 ▶ if (UNIVERSAL::can($class,"xml_validate")) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($class, "xml_validate")) 0 0 0
28 0 my $object = $class->new(__value => $value);
29 0 ▶ if ($object->xml_validate(@_)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($object->xml_validate(@_)) 0 0 0
30 0 return 1;
31 }
32 }
33 }
34
35 0 die "Pastor : Validate : $path : None of the union members validate value '$value'";
36 }
37
38 10 1;
39
40 __END__
« blib/lib/XML/Pastor/Pastorize.pm ↑ Summary blib/lib/XML/Pastor/Schema/Model.pm »