Schema/ElementRefNode.pm

filter: Statementstmt 100% 35 / 35 Branchbran 64.2% 9 / 14 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 85.2% 52 / 61 CC 9 SCAR 18.5
CC
9
Cov
88%
parse
9.4
BEGIN
1.0
BEGIN
1.0
CRAP 6.4
« Schema/ModelNode.pm ↑ Summary Schema/SimpleTypeNode.pm »
1 package XML::Validator::Schema::ElementRefNode;
2 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 5 ▶use base 'XML::Validator::Schema::ElementNode';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 5 ▶use XML::Validator::Schema::Util qw(_err _attr);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 NAME
11  
12 XML::Validator::Schema::ElementRefNode - an element reference node
13  
14 =head1 DESCRIPTION
15  
16 This is an internal module used by XML::Validator::Schema to represent
17 an element reference node.
18  
19 =cut
20  
21 43 ▶sub parse {
Subroutine parse: called CC=9 SCAR=22.4
Pod undocumented
22 43 my ($pkg, $data) = @_;
23 43 my $self = $pkg->new();
24  
25 43 my $ref = _attr($data, 'ref');
26 43 ▶ croak("Why did you create an ElementRefNode if you didn't have a ref?")
Branch: 1 branch
BranchTrueFalseTotal
unless $ref 0 43 43
27 unless $ref;
28 43 $self->{unresolved_ref} = 1;
29 43 $self->name($ref);
30  
31 43 my $name = _attr($data, 'name');
32 43 ▶ _err("Found <element> with illegal combination of 'ref' and 'name' ".
Branch: 1 branch
BranchTrueFalseTotal
if $name 0 43 43
33 "attributes.")
34 if $name;
35  
36 43 my $type_name = _attr($data, 'type');
37 43 ▶ _err("Found <element> with illegal combination of 'ref' and 'type' ".
Branch: 1 branch
BranchTrueFalseTotal
if $type_name 0 43 43
38 "attributes.")
39 if $type_name;
40  
41  
42 43 my $min = _attr($data, 'minOccurs');
43 43 ▶ $min = 1 unless defined $min;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $min 38 5 43
44 43 ▶ _err("Invalid value for minOccurs '$min' found in <element>.")
Branch: 1 branch
BranchTrueFalseTotal
unless $min =~ /^\d+$/ 0 43 43
45 unless $min =~ /^\d+$/;
46 43 $self->{min} = $min;
47  
48 43 my $max = _attr($data, 'maxOccurs');
49 43 ▶ $max = 1 unless defined $max;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $max 37 6 43
50 43 ▶ _err("Invalid value for maxOccurs '$max' found in <element>.")
Branch: 1 branch
BranchTrueFalseTotal
unless $max =~ /^\d+$/ or $max eq "unbounded" 0 43 43
Condition66%2/3
$max =~ /^\d+$/ or $max eq "unbounded"
l!l&&r!l&&!r
4030
MC/DC0%0/2
$max =~ /^\d+$/ or $max eq "unbounded"
$max =~ /^\d+$/ $max eq "unbounded"
Truth table66%2/3
A or B
A= $max =~ /^\d+$/B= $max eq "unbounded"
ABresult
1X1
011
000
51 unless $max =~ /^\d+$/ or $max eq 'unbounded';
52 43 $self->{max} = $max;
53  
54 43 return $self;
55 }
56  
57 5 1;
58  
« Schema/ModelNode.pm ↑ Summary Schema/SimpleTypeNode.pm »