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

filter: Statementstmt 45.9% 17 / 37 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 55.5% 5 / 9 Podpod 100% 4 / 4 totaltotal 41.9% 26 / 62 CC 7 SCAR 29.0
CC
7
Cov
36%
xml_validate
42.0
toList
6.0
setFromList
2.0
CRAP 18.2
« blib/lib/XML/Pastor/Util.pm ↑ Summary blib/lib/XML/Pastor/Schema/Parser.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 # White space separated tokens.
9 #======================================================================
10
11 package XML::Pastor::Builtin::List;
12
13 10 ▶use XML::Pastor::Builtin::SimpleType;
Subroutine BEGIN: called CC=1 SCAR=0.0
14
15 10 our @ISA = qw(XML::Pastor::Builtin::SimpleType);
16
17 #-----------------------------------------------------------------
18 0 ▶sub toList {
Subroutine toList: not called CC=2 SCAR=17.9
Pod documented
19 0 my $self = shift;
20 0 my $value = $self->__value() . "";
21 0 my @list = split /\s+/, $value;
22 0 ▶ return (wantarray ? (@list) : [@list]);
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
23 }
24
25 #-----------------------------------------------------------------
26 0 ▶sub setFromList {
Subroutine setFromList: not called CC=1 SCAR=6.9
Pod documented
27 0 my $self = shift;
28 0 return $self->__value(join (' ', @_));
29 }
30
31 #-----------------------------------------------------------------
32 # A CONSTRUCTOR
33 #-----------------------------------------------------------------
34 0 ▶sub fromList {
Subroutine fromList: not called CC=1 SCAR=6.9
Pod documented
35 0 my $self = shift->new();
36 0 return $self->setFromList(@_);
37 }
38
39 #--------------------------------------------------------------
40 0 ▶sub xml_validate {
Subroutine xml_validate: not called CC=6 SCAR=37.4
Pod documented
41 0 my $self = shift;
42 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
43 0 my $value = $self->__value;
44 0 my $type = $self->XmlSchemaType();
45 0 ▶ my $class = $type->itemClass || "XML::Pastor::SimpleType";
Condition0%0/2
$type->itemClass || 'XML::Pastor::SimpleType'
l!l
00
MC/DC0%0/1
$type->itemClass || 'XML::Pastor::SimpleType'
$type->itemClass
Truth table0%0/2
A
A= $type->itemClass
Aresult
11
00
46
47 0 ▶ unless (UNIVERSAL::can($class,"xml_validate")) {
Branch: 1 branch
BranchTrueFalseTotal
unless (UNIVERSAL::can($class, "xml_validate")) 0 0 0
48 0 return $self->xml_validate_further(@_);
49 }
50
51 0 my @parts = $self->toList();
52
53 0 foreach my $part (@parts) {
54 0 my $object = $class->new(__value => $part);
55 0 ▶ $object->xml_validate(@_) or die "Pastor : Validate : $path : List part '$part' does not validate against class '$class' in list '$value'!";
Branch: 1 branch
BranchTrueFalseTotal
$object->xml_validate(@_) or die "Pastor : Validate : $path : List part '${part}' does not validate against class '${class}' in list '${value}'!" 0 0 0
56 }
57 0 return $self->xml_validate_further(@_);
58 }
59
60
61 10 1;
62
63 __END__
« blib/lib/XML/Pastor/Util.pm ↑ Summary blib/lib/XML/Pastor/Schema/Parser.pm »