| 1 | # Copyrights 2006-2024 by [Mark Overmeer <markov@cpan.org>]. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # For other contributors see ChangeLog. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # See the manual pages for details on the licensing terms. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # Pod stripped from pm file by OODoc 2.03. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # This code is part of distribution XML-Compile. Meta-POD processed with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # OODoc into POD and HTML manual-pages. See README.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Copyright Mark Overmeer. Licensed under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | package XML::Compile::Translate::Reader;{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 45 | our $VERSION = '1.64'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 45 | ▶ | use base 'XML::Compile::Translate'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 45 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 45 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 45 | ▶ | no warnings 'once', 'recursion'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 45 | ▶ | use Log::Report 'xml-compile'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 45 | ▶ | use List::Util qw/first/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 45 | ▶ | use Scalar::Util qw/weaken blessed/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 45 | ▶ | use XML::Compile::Util qw/pack_type odd_elements type_of_node SCHEMA2001i/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 45 | ▶ | use XML::Compile::Iterator (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # Each action implementation returns a code reference, which will be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # used to do the run-time work. The mechanism of `closures' is used to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # keep the important information. Be sure that you understand closures | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # before you attempt to change anything. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # The returned reader subroutines will always be called | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # my @pairs = $reader->($tree); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # Some error messages are labeled with 'misfit' which is used to indicate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # that the structure of found data is not conforming the needs. For optional | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # blocks, these errors are caught and un-done. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1361 | ▶ | sub actsAs($) {$_[1] eq 'READER'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
actsAs: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 953 | ▶ | sub makeTagUnqualified(@) {$_[3]} # ($self, $path, $node, $local, $ns) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeTagUnqualified: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 118 | ▶ | sub makeTagQualified(@) {$_[3]} # same params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeTagQualified: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | sub typemapToHooks($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 400 | ▶ | { my ($self, $hooks, $typemap) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
typemapToHooks: called CC=8 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 400 | ▶ | while(my($type, $action) = each %$typemap) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 3 | ▶ | { defined $action or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 3 | my $hook; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 3 | ▶ | if(!ref $action) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | { my $class = $action; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 45 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 1 | ▶ | keys %{$class.'::'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | or error __x"class {pkg} for typemap {type} is not loaded" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | , pkg => $class, type => $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | ▶ | $class->can('fromXML') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | or error __x"class {pkg} does not implement fromXML(), required for typemap {type}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | , pkg => $class, type => $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | trace "created reader hook for type $type to class $class"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | ▶ | $hook = sub { $class->fromXML($_[1], $type) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | elsif(ref $action eq 'CODE') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | ▶ | { $hook = sub { $action->(READER => $_[1], $type) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | trace "created reader hook for type $type to CODE"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 1 | { my $object = $action; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 1 | ▶ | $object->can('fromXML') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | or error __x"object of class {pkg} does not implement fromXML(), required for typemap {type}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | , pkg => ref($object), type => $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | trace "created reader hook for type $type to object"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | ▶ | $hook = sub {$object->fromXML($_[1], $type)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 3 | push @$hooks, +{action => 'READER', type => $type, after => $hook}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 400 | $hooks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | sub makeElementWrapper | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 394 | ▶ | { my ($self, $path, $processor) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeElementWrapper: called CC=1 SCAR=0.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # no copy of $_[0], because it may be a large string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 401 | ▶ | sub { my $tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=20.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 401 | ▶ | if(blessed $_[0] && $_[0]->isa('XML::LibXML::Iterator')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($_[0]) and $_[0]->isa("XML::LibXML::Iterator")
MC/DC0%0/2
builtin::blessed($_[0]) and $_[0]->isa("XML::LibXML::Iterator")
builtin::blessed($_[0])
$_[0]->isa("XML::LibXML::Iterator")
Truth table33%1/3
A and B
A= builtin::blessed($_[0])B= $_[0]->isa("XML::LibXML::Iterator")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | { $tree = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 401 | ▶ | { my $xml = XML::Compile->dataToXML($_[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 400 | ▶ | $xml = $xml->documentElement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | if $xml->isa('XML::LibXML::Document'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | $tree = XML::Compile::Iterator->new($xml, 'top', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 400 | ▶ | sub { $_[0]->isa('XML::LibXML::Element') } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 400 | my $data = ($processor->($tree))[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 332 | ▶ | unless(defined $data) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | { my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | error __x"data not recognized, found a `{type}' at {where}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | , type => type_of_node $node, where => $node->nodePath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 332 | $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 394 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | sub makeAttributeWrapper | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 4 | ▶ | { my ($self, $path, $processor) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeAttributeWrapper: called CC=1 SCAR=0.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 4 | ▶ | sub { my $attr = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=17.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 4 | ▶ | ref $attr && $attr->isa('XML::LibXML::Attr') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
ref $attr and $attr->isa("XML::LibXML::Attr")
ref $attr || $attr
MC/DC0%0/2
ref $attr and $attr->isa("XML::LibXML::Attr")
ref $attr
$attr->isa("XML::LibXML::Attr")
MC/DC0%0/2
ref $attr || $attr
ref $attr
$attr
Truth table33%1/3
A and B
A= ref $attrB= $attr->isa("XML::LibXML::Attr")
Truth table0%0/3
A || B
A= ref $attrB= $attr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | or error __x"expects an attribute node, but got `{something}' at {path}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | , something => (ref $attr || $attr), path => $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 4 | my $node = XML::LibXML::Element->new('dummy'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 4 | $node->addChild($attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 4 | $processor->($node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | sub makeWrapperNs # no namespaces in the HASH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 62 | ▶ | { my ($self, $path, $processor, $index, $filter) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeWrapperNs: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 62 | $processor; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ## Element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | sub makeSequence($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 227 | ▶ | { my ($self, $path, @pairs) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeSequence: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 227 | ▶ | if(@pairs==2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 89 | { my ($take, $action) = @pairs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | my $code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | = (ref $action eq 'BLOCK' || ref $action eq 'ANY') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 6 | ▶ | ? sub { $action->($_[0]) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 89 | ▶ | : sub { $action->($_[0] && $_[0]->currentType eq $take ? $_[0]:undef)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
Branch: 2 branches
Condition66%4/6
ref $action eq "BLOCK" or ref $action eq "ANY"
$_[0] and $_[0]->currentType eq $take
MC/DC50%1/2
ref $action eq "BLOCK" or ref $action eq "ANY"
ref $action eq "BLOCK"
ref $action eq "ANY"
MC/DC50%1/2
$_[0] and $_[0]->currentType eq $take
$_[0]
$_[0]->currentType eq $take
Truth table66%2/3
A or B
A= ref $action eq "BLOCK"B= ref $action eq "ANY"
Truth table66%2/3
A and B
A= $_[0]B= $_[0]->currentType eq $take
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 89 | return bless $code, 'BLOCK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | bless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 153 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 153 | my @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 153 | my @do = @pairs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 153 | ▶ | while(@do) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 344 | { my ($take, $do) = (shift @do, shift @do); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 344 | ▶ | push @res, ref $do eq 'BLOCK' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
ref $do eq "BLOCK" or ref $do eq "ANY" or defined $tree and $tree->currentType eq $take
ref $do eq "BLOCK" or ref $do eq "ANY"
defined $tree and $tree->currentType eq $take
MC/DC100%4/4
ref $do eq "BLOCK" or ref $do eq "ANY" or defined $tree and $tree->currentType eq $take
ref $do eq "BLOCK"
ref $do eq "ANY"
defined $tree
$tree->currentType eq $take
Truth table100%5/5
A or B or C and D
A= ref $do eq "BLOCK"B= ref $do eq "ANY"C= defined $treeD= $tree->currentType eq $take
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | || ref $do eq 'ANY' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | || (defined $tree && $tree->currentType eq $take) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | ? $do->($tree) : $do->(undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 137 | @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 138 | }, 'BLOCK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | sub makeChoice($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 40 | ▶ | { my ($self, $path, %do) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeChoice: called CC=7 SCAR=20.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 40 | my @specials; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 40 | foreach my $el (keys %do) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | { push @specials, delete $do{$el} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 91 | ▶ | if ref $do{$el} eq 'BLOCK' || ref $do{$el} eq 'ANY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $do{$el} eq "BLOCK" or ref $do{$el} eq "ANY"
MC/DC50%1/2
ref $do{$el} eq "BLOCK" or ref $do{$el} eq "ANY"
ref $do{$el} eq "BLOCK"
ref $do{$el} eq "ANY"
Truth table66%2/3
A or B
A= ref $do{$el} eq "BLOCK"B= ref $do{$el} eq "ANY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 40 | ▶ | if(keys %do==1 && !@specials) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
keys %do == 1 and not @specials
MC/DC100%2/2
keys %do == 1 and not @specials
keys %do == 1
not @specials
Truth table100%3/3
A and not(B)
A= keys %do == 1B= not @specials
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 4 | { my ($option, $action) = %do; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | return bless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 4 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 4 | ▶ | my $type = defined $tree ? $tree->currentType : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 4 | ▶ | return $action->($tree) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | if $type eq $option; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 1 | ▶ | try { $action->(undef) }; # minOccurs=0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | ▶ | $@ or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | ▶ | $type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | or error __x"element `{tag}' expected for choice at {path}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | , tag => $option, path => $path, _class => 'misfit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | error __x"single choice option `{option}' at `{type}' at {path}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | , option => $option, type => $type, path => $path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | , _class => 'misfit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 4 | }, 'BLOCK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | @specials or return bless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 37 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 37 | ▶ | my $type = defined $tree ? $tree->currentType : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 37 | ▶ | my $elem = defined $type ? $do{$type} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 37 | ▶ | return $elem->($tree) if $elem; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | # very silly situation: some people use a minOccurs within | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # a choice, instead on choice itself. That always succeeds. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 4 | foreach my $some (values %do) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 9 | ▶ | { try { $some->(undef) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 9 | ▶ | $@ or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | $type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 3 | ▶ | or error __x"no element left to pick choice at {path}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | , path => $path, _class => 'misfit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 2 | trace "choose element from @{[sort keys %do]}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 2 | error __x"no applicable choice for `{tag}' at {path}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | , tag => $type, path => $path, _class => 'misfit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 36 | ▶ | }, 'BLOCK'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | return bless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 10 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=13 SCAR=35.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 10 | ▶ | my $type = defined $tree ? $tree->currentType : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 10 | ▶ | my $elem = defined $type ? $do{$type} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 10 | ▶ | return $elem->($tree) if $elem; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 6 | my @special_errors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 6 | foreach (@specials) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 8 | ▶ | { my @d = try { $_->($tree) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 8 | ▶ | return @d if !$@ && @d; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $@ and @d
MC/DC50%1/2
not $@ and @d
not $@
@d
Truth table66%2/3
not(A) and B
A= not $@B= @d
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 2 | ▶ | push @special_errors, $@->wasFatal->message if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | foreach my $some (values %do, @specials) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | { try { $some->(undef) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | $@ or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | $type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | or error __x"choice needs more elements at {path}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | , path => $path, _class => 'misfit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my @elems = sort keys %do; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | trace "choose element from @elems or fix special at $path" if @elems; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | trace "failed specials in choice: $_" for @special_errors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | error __x"no applicable choice for `{tag}' at {path}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | , tag => $type, path => $path, _class => 'misfit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 10 | }, 'BLOCK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | sub makeAll($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 30 | ▶ | { my ($self, $path, %pairs) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeAll: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 30 | my %specials; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 30 | foreach my $el (keys %pairs) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | { $specials{$el} = delete $pairs{$el} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 80 | ▶ | if ref $pairs{$el} eq 'BLOCK' || ref $pairs{$el} eq 'ANY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $pairs{$el} eq "BLOCK" or ref $pairs{$el} eq "ANY"
MC/DC50%1/2
ref $pairs{$el} eq "BLOCK" or ref $pairs{$el} eq "ANY"
ref $pairs{$el} eq "BLOCK"
ref $pairs{$el} eq "ANY"
Truth table66%2/3
A or B
A= ref $pairs{$el} eq "BLOCK"B= ref $pairs{$el} eq "ANY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 30 | ▶ | if(!%specials && keys %pairs==1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not %specials and keys %pairs == 1
MC/DC100%2/2
not %specials and keys %pairs == 1
not %specials
keys %pairs == 1
Truth table100%3/3
not(A) and B
A= not %specialsB= keys %pairs == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 5 | { my ($take, $do) = %pairs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | return bless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 4 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 4 | ▶ | $do->($tree && $tree->currentType eq $take ? $tree : undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$tree and $tree->currentType eq $take
MC/DC50%1/2
$tree and $tree->currentType eq $take
$tree
$tree->currentType eq $take
Truth table66%2/3
A and B
A= $treeB= $tree->currentType eq $take
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 5 | }, 'BLOCK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | keys %specials or return bless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 22 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 22 | my %do = %pairs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 22 | my @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 22 | while(1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 67 | ▶ | { my $type = $tree && $tree->currentType or last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$tree && $tree->currentType
MC/DC50%1/2
$tree && $tree->currentType
$tree
$tree->currentType
Truth table66%2/3
A && B
A= $treeB= $tree->currentType
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 46 | ▶ | my $do = delete $do{$type} or last; # already seen? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 45 | push @res, $do->($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # saw all of all? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | push @res, $_->(undef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 22 | for values %do; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 9 | @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 25 | ▶ | }, 'BLOCK'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | # an 'all' block with nested structures or any is quite nasty. Don't | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | # forget that 'all' can have maxOccurs > 1 ! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | bless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 3 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 3 | my %do = %pairs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 3 | my %spseen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | my @res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | PARTICLE: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 3 | while(1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 11 | ▶ | { my $type = $tree->currentType or last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 9 | ▶ | if(my $do = delete $do{$type}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 6 | { push @res, $do->($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 6 | next PARTICLE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 3 | foreach (keys %specials) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 3 | ▶ | { next if $spseen{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 3 | ▶ | my @d = try { $specials{$_}->($tree) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 3 | ▶ | next if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 2 | $spseen{$_}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 2 | push @res, @d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 2 | next PARTICLE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 3 | ▶ | @res or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # saw all of all? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | push @res, $_->(undef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 3 | for values %do; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | push @res, $_->(undef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 3 | ▶ | for map {$spseen{$_} ? () : $specials{$_}} keys %specials; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 2 | @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 3 | }, 'BLOCK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | sub makeBlockHandler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 307 | ▶ | { my ($self, $path, $label, $min, $max, $process, $kind, $multi) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeBlockHandler: called CC=7 SCAR=20.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # flatten the HASH: when a block appears only once, there will | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # not be an additional nesting in the output tree. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 307 | ▶ | if($max ne 'unbounded' && $max==1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$max ne "unbounded" and $max == 1
MC/DC100%2/2
$max ne "unbounded" and $max == 1
$max ne "unbounded"
$max == 1
Truth table100%3/3
A and B
A= $max ne "unbounded"B= $max == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 276 | ▶ | return ($label => $process) if $min==1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | my $code = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 5 | ▶ | sub { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.8
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 5 | ▶ | my $starter = $tree->currentChild or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 4 | ▶ | my @pairs = try { $process->($tree) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 4 | ▶ | if($@->wasFatal(class => 'misfit')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 2 | { my $ending = $tree->currentChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 2 | ▶ | $@->reportAll if !$ending || $ending!=$starter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $ending or $ending != $starter
MC/DC50%1/2
not $ending or $ending != $starter
not $ending
$ending != $starter
Truth table66%2/3
not(A) or B
A= not $endingB= $ending != $starter
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 1 | return (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | elsif($@) {$@->reportAll} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 2 | @pairs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 5 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 5 | return ($label => bless($code, 'BLOCK')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 31 | ▶ | if($max ne 'unbounded' && $min>=$max) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$max ne "unbounded" and $min >= $max
MC/DC0%0/2
$max ne "unbounded" and $min >= $max
$max ne "unbounded"
$min >= $max
Truth table66%2/3
A and B
A= $max ne "unbounded"B= $min >= $max
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | { my $code = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | my @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | while(@res < $min) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | { my @pairs = $process->($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | push @res, {@pairs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ($multi => \@res); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | return ($label => bless($code, 'BLOCK')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 31 | ▶ | if($min==0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | { my $code = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 18 | ▶ | sub { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=11 SCAR=24.4
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 18 | my @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 18 | ▶ | while($max eq 'unbounded' || @res < $max) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$max eq "unbounded" or @res < $max
MC/DC100%2/2
$max eq "unbounded" or @res < $max
$max eq "unbounded"
@res < $max
Truth table100%3/3
A or B
A= $max eq "unbounded"B= @res < $max
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 46 | ▶ | { my $starter = $tree->currentChild or last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 35 | ▶ | my @pairs = try { $process->($tree) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 35 | ▶ | if($@->wasFatal(class => 'misfit')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | { # misfit error is ok, if nothing consumed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 3 | trace "misfit $label ($min..$max) ".$@->wasFatal->message; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 3 | my $ending = $tree->currentChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 3 | ▶ | $@->reportAll if !$ending || $ending!=$starter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $ending or $ending != $starter
MC/DC0%0/2
not $ending or $ending != $starter
not $ending
$ending != $starter
Truth table33%1/3
not(A) or B
A= not $endingB= $ending != $starter
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 3 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | elsif($@) {$@->reportAll} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 32 | ▶ | @pairs or last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 29 | push @res, {@pairs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 18 | ▶ | @res ? ($multi => \@res) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 18 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 18 | return ($label => bless($code, 'BLOCK')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | my $code = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 11 | ▶ | sub { my $tree = shift or error __xn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=11 SCAR=27.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | "block with `{name}' is required at least once at {path}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | , "block with `{name}' is required at least {_count} times at {path}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | , $min, name => $label, path => $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 11 | my @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 11 | ▶ | while(@res < $min) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 11 | { my @pairs = $process->($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 9 | push @res, {@pairs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 9 | ▶ | while($max eq 'unbounded' || @res < $max) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$max eq "unbounded" or @res < $max
MC/DC100%2/2
$max eq "unbounded" or @res < $max
$max eq "unbounded"
@res < $max
Truth table100%3/3
A or B
A= $max eq "unbounded"B= @res < $max
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 20 | ▶ | { my $starter = $tree->currentChild or last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 14 | ▶ | my @pairs = try { $process->($tree) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 14 | ▶ | if($@->wasFatal(class => 'misfit')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | { # misfit error is ok, if nothing consumed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | trace "misfit $label ($min..) ".$@->wasFatal->message; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | my $ending = $tree->currentChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | $@->reportAll if !$ending || $ending!=$starter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $ending or $ending != $starter
MC/DC0%0/2
not $ending or $ending != $starter
not $ending
$ending != $starter
Truth table0%0/3
not(A) or B
A= not $endingB= $ending != $starter
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | elsif($@) {$@->reportAll}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 14 | ▶ | @pairs or last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 13 | push @res, {@pairs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 9 | ($multi => \@res); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 13 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 13 | ($label => bless($code, 'BLOCK')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | sub makeElementHandler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 532 | ▶ | { my ($self, $path, $label, $min, $max, $required, $optional) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeElementHandler: called CC=8 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 532 | ▶ | $max eq "0" and return sub {}; # max can be "unbounded", hence strcmp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 531 | ▶ | if($max ne 'unbounded' && $max==1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$max ne "unbounded" and $max == 1
MC/DC100%2/2
$max ne "unbounded" and $max == 1
$max ne "unbounded"
$max == 1
Truth table100%3/3
A and B
A= $max ne "unbounded"B= $max == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | { return $min==1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 388 | ▶ | ? sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 388 | ▶ | my @pairs = $required->(defined $tree ? $tree->descend :undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 350 | ▶ | $tree->nextChild if defined $tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 350 | ($label => $pairs[1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 83 | ▶ | : sub { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 53 | ▶ | $tree->currentChild or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 53 | my @pairs = $optional->($tree->descend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 52 | $tree->nextChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 52 | ▶ | @pairs or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 52 | ($label => $pairs[1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 504 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 27 | ▶ | if($max ne 'unbounded' && $min>=$max) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$max ne "unbounded" and $min >= $max
MC/DC100%2/2
$max ne "unbounded" and $min >= $max
$max ne "unbounded"
$min >= $max
Truth table100%3/3
A and B
A= $max ne "unbounded"B= $min >= $max
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | { return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 2 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 2 | my @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 2 | ▶ | while(@res < $min) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 4 | ▶ | { my @pairs = $required->(defined $tree ? $tree->descend:undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 3 | push @res, $pairs[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 3 | ▶ | $tree->nextChild if defined $tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 1 | ▶ | @res ? ($label => \@res) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 25 | ▶ | if(!defined $required) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | { return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 22 | ▶ | sub { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 16 | my @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 16 | ▶ | while($max eq 'unbounded' || @res < $max) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$max eq "unbounded" or @res < $max
MC/DC0%0/2
$max eq "unbounded" or @res < $max
$max eq "unbounded"
@res < $max
Truth table66%2/3
A or B
A= $max eq "unbounded"B= @res < $max
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 50 | ▶ | { $tree->currentChild or last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 40 | my @pairs = $optional->($tree->descend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 40 | ▶ | @pairs or last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 34 | push @res, $pairs[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 34 | $tree->nextChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 16 | ▶ | @res ? ($label => \@res) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 22 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 3 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 3 | my @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 3 | ▶ | while(@res < $min) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 3 | ▶ | { my @pairs = $required->(defined $tree ? $tree->descend : undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 3 | push @res, $pairs[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 3 | ▶ | $tree->nextChild if defined $tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 3 | ▶ | while(defined $tree && ($max eq 'unbounded' || @res < $max)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
defined $tree and $max eq "unbounded" || @res < $max
$max eq "unbounded" or @res < $max
MC/DC66%2/3
defined $tree and $max eq "unbounded" || @res < $max
defined $tree
$max eq "unbounded"
@res < $max
Truth table75%3/4
A and B or C
A= defined $treeB= $max eq "unbounded"C= @res < $max
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 4 | ▶ | { $tree->currentChild or last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 3 | my @pairs = $optional->($tree->descend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 3 | ▶ | @pairs or last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 2 | push @res, $pairs[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 2 | $tree->nextChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 3 | ($label => \@res); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | sub makeRequired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 439 | ▶ | { my ($self, $path, $label, $do) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeRequired: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | my $req = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 395 | ▶ | sub { my $tree = shift; # can be undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 395 | my @pairs = $do->($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | @pairs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 390 | ▶ | or error __x"data for element or block starting with `{tag}' missing at {path}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | , tag => $label, path => $path, _class => 'misfit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 356 | @pairs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 439 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 439 | ▶ | ref $do eq 'BLOCK' ? bless($req, 'BLOCK') : $req; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | sub makeElementHref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | ▶ | { my ($self, $path, $ns, $childname, $do) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeElementHref: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | return ($childname => $tree->node) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $tree and $tree->nodeType eq $childname and $tree->node->hasAttribute("href")
defined $tree and $tree->nodeType eq $childname
MC/DC0%0/3
defined $tree and $tree->nodeType eq $childname and $tree->node->hasAttribute("href")
defined $tree
$tree->nodeType eq $childname
$tree->node->hasAttribute("href")
Truth table0%0/4
A and B and C
A= defined $treeB= $tree->nodeType eq $childnameC= $tree->node->hasAttribute("href")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | if defined $tree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | && $tree->nodeType eq $childname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | && $tree->node->hasAttribute('href'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | $do->($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | sub makeElement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 916 | ▶ | { my ($self, $path, $ns, $childname, $do) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeElement: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 876 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 876 | ▶ | my $value = defined $tree && $tree->nodeType eq $childname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $tree and $tree->nodeType eq $childname
MC/DC100%2/2
defined $tree and $tree->nodeType eq $childname
defined $tree
$tree->nodeType eq $childname
Truth table100%3/3
A and B
A= defined $treeB= $tree->nodeType eq $childname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | ? $do->($tree) : $do->(undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 803 | ▶ | defined $value ? ($childname => $value) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 916 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | sub makeElementDefault | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 19 | ▶ | { my ($self, $path, $ns, $childname, $do, $default) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeElementDefault: called CC=4 SCAR=14.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 19 | my $mode = $self->{default_values}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | $mode eq 'IGNORE' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | and return sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 2 | ▶ | { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=16.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 2 | ▶ | return () if $tree->nodeType ne $childname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$tree->nodeType ne $childname or $tree->node->textContent eq ""
MC/DC0%0/2
$tree->nodeType ne $childname or $tree->node->textContent eq ""
$tree->nodeType ne $childname
$tree->node->textContent eq ""
Truth table33%1/3
A or B
A= $tree->nodeType ne $childnameB= $tree->node->textContent eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | || $tree->node->textContent eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 2 | $do->($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 19 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 17 | my $def = $do->($default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | $mode eq 'EXTEND' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | and return sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 15 | ▶ | { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 15 | ▶ | return ($childname => $def) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
not defined $tree or $tree->nodeType ne $childname or $tree->node->textContent eq ""
not defined $tree or $tree->nodeType ne $childname
MC/DC66%2/3
not defined $tree or $tree->nodeType ne $childname or $tree->node->textContent eq ""
not defined $tree
$tree->nodeType ne $childname
$tree->node->textContent eq ""
Truth table75%3/4
not(A) or B or C
A= not defined $treeB= $tree->nodeType ne $childnameC= $tree->node->textContent eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | if !defined $tree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | || $tree->nodeType ne $childname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | || $tree->node->textContent eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 7 | $do->($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 17 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | $mode eq 'MINIMAL' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | and return sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 3 | ▶ | { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=19.3
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 3 | ▶ | return () if $tree->nodeType ne $childname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$tree->nodeType ne $childname or $tree->node->textContent eq ""
MC/DC0%0/2
$tree->nodeType ne $childname or $tree->node->textContent eq ""
$tree->nodeType ne $childname
$tree->node->textContent eq ""
Truth table33%1/3
A or B
A= $tree->nodeType ne $childnameB= $tree->node->textContent eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | || $tree->node->textContent eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 3 | my $v = $do->($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 3 | ▶ | undef $v if defined $v && $v eq $def; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $v and $v eq $def
MC/DC50%1/2
defined $v and $v eq $def
defined $v
$v eq $def
Truth table66%2/3
A and B
A= defined $vB= $v eq $def
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 3 | ($childname => $v); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 3 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | error __x"illegal default_values mode `{mode}'", mode => $mode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | sub makeElementFixed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 3 | ▶ | { my ($self, $path, $ns, $childname, $do, $fixed) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeElementFixed: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 3 | my ($tag, $fix) = $do->($fixed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 3 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 3 | ▶ | my ($label, $value) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$tree and $tree->nodeType eq $childname
MC/DC50%1/2
$tree and $tree->nodeType eq $childname
$tree
$tree->nodeType eq $childname
Truth table66%2/3
A and B
A= $treeB= $tree->nodeType eq $childname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | = $tree && $tree->nodeType eq $childname ? $do->($tree) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 3 | ▶ | defined $value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | or return ($tag => $fix); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 2 | ▶ | $value eq $fix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | or error __x"element `{name}' must have fixed value `{fixed}', got `{value}' at {path}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | , name => $childname, fixed => $fix, value => $value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | , path => $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 2 | ($label => $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | sub makeElementAbstract | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 10 | ▶ | { my ($self, $path, $ns, $childname, $do, $tag) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeElementAbstract: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 3 | ▶ | sub { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 2 | ▶ | $tree->nodeType eq $childname or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 2 | error __x"abstract element `{name}' used at {path}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | , name => $childname, path => $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | # complexType and complexType/ComplexContent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | # Be warned that the location reported in 'path' may not be the actual | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | # location, caused by the cashing of compiled schema components. The | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | # path you see is the first path where that element was encountered. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | sub _not_processed($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 4 | ▶ | { my ($child, $path) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_not_processed: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 4 | error __x"element `{name}' not processed for {path} at {where}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | , name => type_of_node($child), path => $path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | , _class => 'misfit', where => $child->nodePath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | sub makeComplexElement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 269 | ▶ | { my ($self, $path, $tag, $elems, $attrs, $attrs_any,undef,$is_nillable) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeComplexElement: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 269 | my @e = @$elems; my @a = @$attrs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 269 | my @elems = odd_elements @$elems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 269 | my @attrs = (odd_elements(@$attrs), @$attrs_any); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | $is_nillable and return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 10 | ▶ | sub { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 10 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 10 | ▶ | my %complex = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | ( ($tree->nodeNil ? (_ => 'NIL') : (map $_->($tree), @elems)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | , (map $_->($node), @attrs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 10 | ▶ | _not_processed $tree->currentChild, $path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | if $tree->currentChild; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 10 | ($tag => \%complex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 269 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | @elems > 1 || @attrs and return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 63 | ▶ | sub { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 62 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 62 | my %complex = ((map $_->($tree), @elems), (map $_->($node), @attrs)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | #if($tree->currentChild) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | #{ warn "COMPLEX ELEMS($tag) @e;@a"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 58 | ▶ | _not_processed $tree->currentChild, $path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | if $tree->currentChild; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 58 | ($tag => \%complex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 263 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@elems > 1 or @attrs
MC/DC100%2/2
@elems > 1 or @attrs
@elems > 1
@attrs
Truth table100%3/3
A or B
A= @elems > 1B= @attrs
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | @elems || return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 9 | ▶ | sub { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.7
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 9 | ▶ | _not_processed $tree->currentChild, $path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | if $tree->currentChild; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 9 | ($tag => {}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 205 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 194 | my $el = shift @elems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 190 | ▶ | sub { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 190 | my %complex = $el->($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 161 | ▶ | _not_processed $tree->currentChild, $path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | if $tree->currentChild; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 157 | ($tag => \%complex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 194 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | # complexType/simpleContent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | sub makeTaggedElement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 10 | ▶ | { my ($self, $path, $tag, $st, $attrs, $attrs_any,undef,$is_nillable) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeTaggedElement: called CC=1 SCAR=0.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 10 | my @attrs = (odd_elements(@$attrs), @$attrs_any); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 11 | ▶ | sub { my $tree = shift // return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=22.1
Condition50%1/2
shift() // (return ())
MC/DC0%0/1
shift() // (return ())
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 11 | ▶ | my $simple = $is_nillable && ref $tree && $tree->nodeNil ? 'NIL' : $st->($tree); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$is_nillable and ref $tree and $tree->nodeNil
$is_nillable and ref $tree
MC/DC33%1/3
$is_nillable and ref $tree and $tree->nodeNil
$is_nillable
ref $tree
$tree->nodeNil
Truth table50%2/4
A and B and C
A= $is_nillableB= ref $treeC= $tree->nodeNil
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 11 | ▶ | ref $tree or return ($tag => {_ => $simple}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 10 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 10 | my @pairs = map $_->($node), @attrs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 10 | ▶ | defined $simple || @pairs ? ($tag => {_ => $simple, @pairs}) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $simple or @pairs
MC/DC0%0/2
defined $simple or @pairs
defined $simple
@pairs
Truth table33%1/3
A or B
A= defined $simpleB= @pairs
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | # complexType mixed or complexContent mixed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | sub makeMixedElement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 6 | ▶ | { my ($self, $path, $tag, $elems, $attrs, $attrs_any,undef,$is_nillable) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeMixedElement: called CC=9 SCAR=23.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 6 | my @attrs = (odd_elements(@$attrs), @$attrs_any); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | my $mixed = $self->{mixed_elements} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 6 | ▶ | or panic "how to handle mixed?"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 6 | ▶ | $is_nillable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | and panic "nillable mixed not yet supported"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | ref $mixed eq 'CODE' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 1 | ▶ | ? sub { my $tree = shift or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 1 | ▶ | my $node = $tree->node or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 1 | my @v = $mixed->($path, $node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 1 | ▶ | @v ? ($tag => $v[0]) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | : $mixed eq 'XML_NODE' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 1 | ▶ | ? sub {$_[0] ? ($tag => $_[0]->node) : () } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | : $mixed eq 'ATTRIBUTES' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 2 | ▶ | ? sub { my $tree = shift or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 2 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 2 | my @pairs = map $_->($node), @attrs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 2 | ($tag => { _ => $node, @pairs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | , _MIXED_ELEMENT_MODE => 'ATTRIBUTES'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | : $mixed eq 'TEXTUAL' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 1 | ▶ | ? sub { my $tree = shift or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 1 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 1 | my @pairs = map $_->($node), @attrs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 1 | ($tag => { _ => $node->textContent, @pairs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | , _MIXED_ELEMENT_MODE => 'TEXTUAL'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | : $mixed eq 'XML_STRING' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 1 | ▶ | ? sub { my $tree = shift or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.7
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 1 | ▶ | my $node = $tree->node or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 1 | ($tag => $node->toString); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 6 | ▶ | : $mixed eq 'STRUCTURAL' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | # this cannot be reached, because handled somewhere else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | ? panic "mixed structural handled as normal element" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | : error __x"unknown mixed_elements value `{value}'", value => $mixed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | # simpleType | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | sub makeSimpleElement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 663 | ▶ | { my ( $self, $path, $tag, $st, undef, undef, $comptype, $is_nillable) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeSimpleElement: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | $is_nillable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 15 | ▶ | ? sub { my $tree = shift // return $st->(undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.3
Condition100%2/2
shift() // (return &$st(undef))
MC/DC100%1/1
shift() // (return &$st(undef))
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 14 | ▶ | my $value = (ref $tree && $tree->nodeNil) ? 'NIL' : $st->($tree); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $tree and $tree->nodeNil
MC/DC50%1/2
ref $tree and $tree->nodeNil
ref $tree
$tree->nodeNil
Truth table66%2/3
A and B
A= ref $treeB= $tree->nodeNil
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 14 | ▶ | defined $value ? ($tag => $value) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 606 | ▶ | : sub { my $value = $st->(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 570 | ▶ | defined $value ? ($tag => $value) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 663 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | sub default_anytype_handler($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 1 | ▶ | { my ($path, $node) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_anytype_handler: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 1 | ▶ | ref $node or return $node; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 1 | ▶ | (first{ UNIVERSAL::isa($_, 'XML::LibXML::Element') } $node->childNodes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | ? $node : $node->textContent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | sub makeBuiltin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 807 | ▶ | { my ($self, $path, $node, $type, $def, $check_values) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeBuiltin: called CC=8 SCAR=21.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 807 | ▶ | if($type =~ m/}anyType$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 8 | ▶ | if(my $a = $self->{any_type}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 1 | ▶ | { return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 1 | ▶ | my $node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $_[0] and UNIVERSAL::isa($_[0], "XML::Compile::Iterator")
MC/DC0%0/2
ref $_[0] and UNIVERSAL::isa($_[0], "XML::Compile::Iterator")
ref $_[0]
UNIVERSAL::isa($_[0], "XML::Compile::Iterator")
Truth table33%1/3
A and B
A= ref $_[0]B= UNIVERSAL::isa($_[0], "XML::Compile::Iterator")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | = ref $_[0] && UNIVERSAL::isa($_[0], 'XML::Compile::Iterator') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | ? $_[0]->node : $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 1 | $a->( $path, $node, \&default_anytype_handler)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | { return sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 7 | ▶ | { ref $_[0] or return $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 7 | ▶ | my $node = UNIVERSAL::isa($_[0], 'XML::Compile::Iterator') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | ? $_[0]->node : $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 5 | ▶ | (first{ UNIVERSAL::isa($_, 'XML::LibXML::Element') } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 7 | ▶ | $node->childNodes) ? $node : $node->textContent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 799 | ▶ | my $check = $check_values ? $def->{check} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 799 | my $parse = $def->{parse}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 799 | ▶ | my $err = $path eq $type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | ? N__"illegal value `{value}' for type {type}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | : N__"illegal value `{value}' for type {type} at {path}"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | $check | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | ? ( defined $parse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 679 | ▶ | ? sub { my $value = ref $_[0] ? $_[0]->textContent : $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 679 | ▶ | defined $value or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 640 | ▶ | return $parse->($value, $_[1]||$_[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$_[1] || $_[0]
MC/DC100%2/2
$_[1] || $_[0]
$_[1]
$_[0]
Truth table100%3/3
A || B
A= $_[1]B= $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | if $check->($value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 12 | error __x$err, value => $value, type => $type, path => $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | ▶ | : sub { my $value = ref $_[0] ? $_[0]->textContent : $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | ▶ | defined $value or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | ▶ | return $value if $check->($value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | error __x$err, value => $value, type => $type, path => $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | : ( defined $parse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 13 | ▶ | ? sub { my $value = ref $_[0] ? $_[0]->textContent : $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 13 | ▶ | defined $value or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 13 | ▶ | $parse->($value, $_[1]||$_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$_[1] || $_[0]
MC/DC0%0/2
$_[1] || $_[0]
$_[1]
$_[0]
Truth table66%2/3
A || B
A= $_[1]B= $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 57 | ▶ | : sub { ref $_[0] ? shift->textContent : $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 799 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | sub makeList | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 28 | ▶ | { my ($self, $path, $st) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeList: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 27 | ▶ | sub { my $tree = shift // return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.3
Condition50%1/2
shift() // (return undef)
MC/DC0%0/1
shift() // (return undef)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 27 | ▶ | my $node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | = UNIVERSAL::isa($tree, 'XML::LibXML::Node') ? $tree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | : ref $tree ? $tree->node : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 27 | ▶ | my $v = ref $tree ? $tree->textContent : $tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 27 | [ grep defined, map $st->($_, $node), split " ", $v ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 28 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | sub makeFacetsList | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 11 | ▶ | { my ($self, $path, $st, $info, $early, $late) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeFacetsList: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 11 | my @e = grep defined, @$early; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 11 | my @l = grep defined, @$late; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | # enumeration and pattern are probably rare | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 7 | ▶ | @e or return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 7 | ▶ | my $values = $st->(@_) // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
&$st(@_) // (return)
MC/DC0%0/1
&$st(@_) // (return)
&$st(@_)
Truth table50%1/2
A
A= &$st(@_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 7 | $_->($values) for @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 4 | $values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 11 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 4 | ▶ | sub { defined $_[0] or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=18.8
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 4 | ▶ | my $list = ref $_[0] ? $_[0]->textContent : $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 4 | $_->($list) for @e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 3 | ▶ | my $values = $st->($_[0]) // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
&$st($_[0]) // (return)
MC/DC0%0/1
&$st($_[0]) // (return)
&$st($_[0])
Truth table50%1/2
A
A= &$st($_[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 3 | $_->($values) for @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 3 | $values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | sub makeFacets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 94 | ▶ | { my ($self, $path, $st, $info, $early, $late) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeFacets: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 94 | ▶ | @$early || @$late or return $st; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@$early or @$late
MC/DC100%2/2
@$early or @$late
@$early
@$late
Truth table100%3/3
A or B
A= @$earlyB= @$late
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 93 | ▶ | unless(@$early) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 73 | ▶ | { return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 73 | my $v = $st->(shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 72 | ▶ | defined $v or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 72 | $v = $_->($v) for @$late; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 47 | $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 79 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 12 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=18.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 12 | my $v = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 12 | ▶ | if(@$early) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 12 | ▶ | { return if !defined $v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 12 | $v = $_->($v) for @$early; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 9 | ▶ | $v = $st->($v) // return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
&$st($v) // (return undef)
MC/DC0%0/1
&$st($v) // (return undef)
&$st($v)
Truth table50%1/2
A
A= &$st($v)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 9 | $v = $_->($v) for @$late; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 9 | $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 14 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | sub makeUnion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 19 | ▶ | { my ($self, $path, @types) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeUnion: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 26 | ▶ | sub { my $tree = shift // return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=18.0
Condition50%1/2
shift() // (return undef)
MC/DC0%0/1
shift() // (return undef)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 26 | ▶ | for(@types) { my $v = try { $_->($tree) }; $@ or return $v } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 3 | ▶ | my $text = ref $tree ? $tree->textContent : $tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 3 | ▶ | substr $text, 20, -5, '...' if length($text) > 50; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 3 | error __x"no match for `{text}' in union at {path}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | , text => $text, path => $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 19 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | # Attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | sub makeAttributeRequired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 12 | ▶ | { my ($self, $path, $ns, $tag, $label, $do) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeAttributeRequired: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 12 | ▶ | sub { my $node = $_[0]->getAttributeNodeNS($ns, $tag); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 12 | ▶ | defined $node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | or error __x"attribute `{name}' is required at {path}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | , name => $tag, path => $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 11 | ▶ | defined $node or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 11 | my $value = $do->($node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 11 | ▶ | defined $value ? ($label => $value) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 12 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | sub makeAttributeProhibited | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 3 | ▶ | { my ($self, $path, $ns, $tag, $label, $do) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeAttributeProhibited: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 3 | ▶ | sub { my $node = $_[0]->getAttributeNodeNS($ns, $tag); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 3 | ▶ | defined $node or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 1 | error __x"attribute `{name}' is prohibited at {path}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | , name => $tag, path => $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | sub makeAttribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 94 | ▶ | { my ($self, $path, $ns, $tag, $label, $do) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeAttribute: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 94 | ▶ | sub { my $node = $_[0]->getAttributeNodeNS($ns, $tag); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 94 | ▶ | defined $node or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 72 | my $val = $do->($node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 70 | ▶ | defined $val ? ($label => $val) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 94 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | sub makeAttributeDefault | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 7 | ▶ | { my ($self, $path, $ns, $tag, $label, $do, $default) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeAttributeDefault: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 7 | my $mode = $self->{default_values}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | $mode eq 'IGNORE' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | and return sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 3 | ▶ | { my $node = $_[0]->getAttributeNodeNS($ns, $tag); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 7 | ▶ | defined $node ? ($label => $do->($node)) : () }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 5 | my $def = $do->($default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | $mode eq 'EXTEND' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | and return sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 4 | ▶ | { my $node = $_[0]->getAttributeNodeNS($ns, $tag); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 4 | ▶ | ($label => ($node ? $do->($node) : $def)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 5 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | $mode eq 'MINIMAL' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | and return sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 3 | ▶ | { my $node = $_[0]->getAttributeNodeNS($ns, $tag); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 3 | ▶ | my $v = $node ? $do->($node) : $def; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 3 | ▶ | !defined $v || $v eq $def ? () : ($label => $v); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $v or $v eq $def
MC/DC50%1/2
not defined $v or $v eq $def
not defined $v
$v eq $def
Truth table66%2/3
not(A) or B
A= not defined $vB= $v eq $def
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 2 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | error __x"illegal default_values mode `{mode}'", mode => $mode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | sub makeAttributeFixed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 5 | ▶ | { my ($self, $path, $ns, $tag, $label, $do, $fixed) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeAttributeFixed: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 5 | my $def = $do->($fixed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 5 | ▶ | sub { my $node = $_[0]->getAttributeNodeNS($ns, $tag) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | or return ($label => $def); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 4 | my $value = $do->($node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 4 | ▶ | defined $value && $value eq $def | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $value and $value eq $def
MC/DC50%1/2
defined $value and $value eq $def
defined $value
$value eq $def
Truth table66%2/3
A and B
A= defined $valueB= $value eq $def
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | or error __x"value of attribute `{tag}' is fixed to `{fixed}', not `{value}' at {path}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | , tag => $tag, fixed => $def, value => $value, path => $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 3 | ($label => $def); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 5 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | # SubstitutionGroups | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | sub makeSubstgroup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 10 | ▶ | { my ($self, $path, $base, %do) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeSubstgroup: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | ▶ | keys %do or return bless sub { () }, 'BLOCK'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | bless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 17 | ▶ | sub { my $tree = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 17 | ▶ | my $type = ($tree ? $tree->currentType : undef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | or error __x"no data for substitution group {type} at {path}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | , type => $base, path => $path, class => 'misfit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 17 | ▶ | my $do = $do{$type} or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 13 | my @subst = $do->[1]($tree->descend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 12 | ▶ | @subst or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 12 | $tree->nextChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 12 | ($do->[0] => $subst[1]); # key-rewrite | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 10 | }, 'BLOCK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | # anyAttribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | sub makeAnyAttribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 5 | ▶ | { my ($self, $path, $handler, $yes, $no, $process) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeAnyAttribute: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 5 | ▶ | return () unless defined $handler; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 4 | ▶ | my %yes = map +($_ => 1), @{$yes || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$yes || []
MC/DC100%1/1
$yes || []
$yes
Truth table100%2/2
A
A= $yes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 4 | ▶ | my %no = map +($_ => 1), @{$no || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$no || []
MC/DC100%1/1
$no || []
$no
Truth table100%2/2
A
A= $no
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | # Takes all, before filtering | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | my $all = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 4 | ▶ | sub { my @result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 4 | foreach my $attr ($_[0]->attributes) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 16 | ▶ | { $attr->isa('XML::LibXML::Attr') or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 8 | ▶ | my $ns = $attr->namespaceURI || $_[0]->namespaceURI || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition60%3/5
$attr->namespaceURI || $_[0]->namespaceURI || ''
$attr->namespaceURI or $_[0]->namespaceURI
MC/DC0%0/2
$attr->namespaceURI || $_[0]->namespaceURI || ''
$attr->namespaceURI
$_[0]->namespaceURI
Truth table66%2/3
A or B
A= $attr->namespaceURIB= $_[0]->namespaceURI
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 8 | ▶ | next if keys %yes && !$yes{$ns}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
keys %yes and not $yes{$ns}
MC/DC100%2/2
keys %yes and not $yes{$ns}
keys %yes
not $yes{$ns}
Truth table100%3/3
A and not(B)
A= keys %yesB= not $yes{$ns}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 7 | ▶ | next if keys %no && $no{$ns}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
keys %no and $no{$ns}
MC/DC100%2/2
keys %no and $no{$ns}
keys %no
$no{$ns}
Truth table100%3/3
A and B
A= keys %noB= $no{$ns}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 6 | push @result, pack_type($ns, $attr->localName) => $attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 4 | @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 4 | weaken $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | # Create filter if requested | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | my $run = $handler eq 'TAKE_ALL' ? $all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | : ref $handler ne 'CODE' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | ? error(__x"any_attribute handler `{got}' not understood", got => $handler) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 1 | ▶ | : sub { my @attrs = $all->(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 1 | my @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 1 | ▶ | while(@attrs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 2 | { my ($type, $data) = (shift @attrs, shift @attrs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 2 | my ($label, $out) = $handler->($type, $data, $path, $self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 2 | ▶ | push @result, $label, $out if defined $label; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 1 | @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 4 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 4 | bless $run, 'ANY'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | # anyElement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | sub makeAnyElement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 5 | ▶ | { my ($self, $path, $handler, $yes, $no, $process, $min, $max) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeAnyElement: called CC=9 SCAR=28.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 5 | ▶ | $handler ||= 'SKIP_ALL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$handler ||= "SKIP_ALL"
MC/DC100%1/1
$handler ||= "SKIP_ALL"
$handler
Truth table100%2/2
A
A= $handler
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 5 | ▶ | my %yes = map +($_ => 1), @{$yes || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$yes || []
MC/DC100%1/1
$yes || []
$yes
Truth table100%2/2
A
A= $yes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 5 | ▶ | my %no = map +($_ => 1), @{$no || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$no || []
MC/DC100%1/1
$no || []
$no
Truth table100%2/2
A
A= $no
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | # Takes all, before filtering | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | my $any = ($max eq 'unbounded' || $max > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | ? sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 5 | ▶ | { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=11 SCAR=25.4
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 5 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 5 | my %result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 5 | ▶ | while( (my $child = $tree->currentChild) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
my $child = $tree->currentChild and $max eq "unbounded" || $count < $max
$max eq "unbounded" or $count < $max
MC/DC33%1/3
my $child = $tree->currentChild and $max eq "unbounded" || $count < $max
my $child = $tree->currentChild
$max eq "unbounded"
$count < $max
Truth table50%2/4
A and B or C
A= my $child = $tree->currentChildB= $max eq "unbounded"C= $count < $max
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | && ($max eq 'unbounded' || $count < $max)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 2 | ▶ | { my $ns = $child->namespaceURI || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$child->namespaceURI || ''
MC/DC0%0/1
$child->namespaceURI || ''
$child->namespaceURI
Truth table50%1/2
A
A= $child->namespaceURI
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 2 | ▶ | $yes{$ns} or last if keys %yes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
keys %yes && ($yes{$ns} || (last))
$yes{$ns} or last
MC/DC0%0/2
keys %yes && ($yes{$ns} || (last))
keys %yes
$yes{$ns}
Truth table33%1/3
A && B
A= keys %yesB= $yes{$ns}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 2 | ▶ | $no{$ns} and last if keys %no; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
keys %no && ($no{$ns} && (last))
$no{$ns} and last
MC/DC0%0/2
keys %no && ($no{$ns} && (last))
keys %no
$no{$ns}
Truth table66%2/3
A && B
A= keys %noB= $no{$ns}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 2 | my $k = pack_type $ns, $child->localName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 2 | push @{$result{$k}}, $child; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 2 | $count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 2 | $tree->nextChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 5 | ▶ | $count >= $min | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | or error __x"too few any elements, requires {min} and got {found}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | , min => $min, found => $count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 5 | %result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | : sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | ▶ | { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 0 | ▶ | my $child = $tree->currentChild or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 0 | ▶ | my $ns = $child->namespaceURI || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$child->namespaceURI || ''
MC/DC0%0/1
$child->namespaceURI || ''
$child->namespaceURI
Truth table0%0/2
A
A= $child->namespaceURI
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 0 | ▶ | (!keys %yes || $yes{$ns}) && !(keys %no && $no{$ns}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
!keys(%yes) || $yes{$ns} and not keys %no && $no{$ns}
not keys %yes or $yes{$ns}
keys %no && $no{$ns}
MC/DC0%0/4
!keys(%yes) || $yes{$ns} and not keys %no && $no{$ns}
not keys %yes
$yes{$ns}
keys %no
$no{$ns}
Truth table0%0/7
not(A) or B and not(C && D)
A= not keys %yesB= $yes{$ns}C= keys %noD= $no{$ns}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 0 | $tree->nextChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 0 | (type_of_node($child), $child); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 5 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$max eq "unbounded" or $max > 1
MC/DC0%0/2
$max eq "unbounded" or $max > 1
$max eq "unbounded"
$max > 1
Truth table33%1/3
A or B
A= $max eq "unbounded"B= $max > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 5 | bless $any, 'ANY'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | # I would like to weaken here, but "ANY" needs the whole compiler structure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | # intact: someone has to catch it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | # weaken $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | # Create filter if requested | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | my $run | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | = $handler eq 'TAKE_ALL' ? $any | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 1 | ▶ | : $handler eq 'SKIP_ALL' ? sub { $any->(@_); () } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | : ref $handler ne 'CODE' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | ? error(__x"any_element handler `{got}' not understood", got => $handler) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 0 | ▶ | : sub { my @elems = $any->(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | my @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 0 | ▶ | while(@elems) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 0 | { my ($type, $data) = (shift @elems, shift @elems); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | my ($label, $out) = $handler->($type, $data, $path, $self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 0 | ▶ | push @result, $label, $out if defined $label; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 5 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 5 | bless $run, 'ANY'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | # xsi:type handling | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | sub makeXsiTypeSwitch($$$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 3 | ▶ | { my ($self, $where, $elem, $default_type, $types) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeXsiTypeSwitch: called CC=1 SCAR=0.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 7 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 7 | ▶ | my $tree = shift or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 7 | ▶ | my $node = $tree->node or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 7 | my $type = $node->getAttributeNS(SCHEMA2001i, 'type'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 7 | my ($alt, $code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 7 | ▶ | if($type) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 6 | ▶ | { my ($pre, $local) = $type =~ /(.*?)\:(.*)/ ? ($1, $2) : ('',$type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 6 | $alt = pack_type $node->lookupNamespaceURI($pre), $local; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 6 | ▶ | $code = $types->{$alt} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | or error __x"specified xsi:type list for `{default}' does not contain `{got}'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | , default => $default_type, got => $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 1 | { ($alt, $code) = ($default_type, $types->{$default_type}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | 7 | my ($t, $d) = $code->($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 7 | ▶ | defined $t or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 6 | ▶ | $d = { _ => $d } if ref $d ne 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 6 | ▶ | $d->{XSI_TYPE} ||= $alt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$d->{"XSI_TYPE"} ||= $alt
MC/DC0%0/2
$d->{"XSI_TYPE"} ||= $alt
$d->{"XSI_TYPE"}
$alt
Truth table33%1/3
A ||= B
A= $d->{"XSI_TYPE"}B= $alt
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 6 | ($t, $d); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | # any kind of hook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | sub makeHook($$$$$$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 11 | ▶ | { my ($self, $path, $r, $tag, $before, $replace, $after, $fulltype) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeHook: called CC=9 SCAR=22.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 11 | ▶ | return $r unless $before || $replace || $after; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$before or $replace or $after
$before or $replace
MC/DC0%0/3
$before or $replace or $after
$before
$replace
$after
Truth table75%3/4
A or B or C
A= $beforeB= $replaceC= $after
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 1 | ▶ | return sub { ($_[0]->node->localName => 'SKIPPED') } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 11 | ▶ | if $replace && grep $_ eq 'SKIP', @$replace; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$replace and grep(($_ eq "SKIP"), @$replace)
MC/DC50%1/2
$replace and grep(($_ eq "SKIP"), @$replace)
$replace
grep(($_ eq "SKIP"), @$replace)
Truth table66%2/3
A and B
A= $replaceB= grep(($_ eq "SKIP"), @$replace)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 10 | ▶ | my @replace = $replace ? map $self->_decodeReplace($path,$_),@$replace : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 10 | ▶ | my @before = $before ? map $self->_decodeBefore($path,$_), @$before : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 10 | ▶ | my @after = $after ? map $self->_decodeAfter($path,$_), @$after : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 10 | weaken $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 10 | ▶ | { my $tree = shift or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=23.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 10 | my $xml = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 10 | foreach (@before) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 3 | { $xml = $_->($xml, $path, $fulltype); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 3 | ▶ | defined $xml or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 10 | ▶ | my $process = sub { $r->($tree->descend($xml)) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 10 | ▶ | my @h = @replace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | ? map $_->($xml, $self, $path, $tag, $process, $fulltype), @replace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | : $process->(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 10 | ▶ | @h or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 10 | ▶ | my $h = @h==1 ? $h[0] : $h[1]; # detect simpleType | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 10 | foreach my $after (@after) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 13 | { $h = $after->($xml, $h, $path, $fulltype); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 13 | ▶ | defined $h or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 10 | ($tag => $h); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | sub _decodeBefore($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | 3 | ▶ | { my ($self, $path, $call) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decodeBefore: called CC=3 SCAR=17.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 3 | ▶ | return $call if ref $call eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 0 | ▶ | $call eq 'PRINT_PATH' ? sub {print "$_[1]\n"; $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 0 | ▶ | : error __x"labeled before hook `{call}' undefined for READER", call=>$call; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | sub _decodeReplace($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 0 | ▶ | { my ($self, $path, $call) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decodeReplace: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | 0 | ▶ | return $call if ref $call eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 0 | ▶ | $call eq 'XML_NODE' ? sub { ($_[3] => $_[0]) } # don't parse XML | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 0 | ▶ | : error __x"labeled replace hook `{call}' undefined for READER",call=>$call; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | my %after = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 1 | ▶ | ( PRINT_PATH => sub {print "$_[2]\n"; $_[1] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 0 | ▶ | , INCLUDE_PATH => sub { my $h = $_[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 0 | ▶ | $h = { _ => $h } if ref $h ne 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 0 | $h->{_PATH} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 0 | $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 1 | ▶ | , XML_NODE => sub { my $h = $_[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 1 | ▶ | $h = { _ => $h } if ref $h ne 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 1 | $h->{_XML_NODE} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 1 | $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 2 | ▶ | , ELEMENT_ORDER => sub { my ($xml, $h) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 2 | ▶ | $h = { _ => $h } if ref $h ne 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 2 | my @order = map type_of_node($_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | , grep $_->isa('XML::LibXML::Element'), $xml->childNodes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 2 | $h->{_ELEMENT_ORDER} = \@order; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 2 | $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | 2 | ▶ | , ATTRIBUTE_ORDER => sub { my ($xml, $h) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 2 | ▶ | $h = { _ => $h } if ref $h ne 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 2 | my @order = map $_->nodeName, $xml->attributes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 2 | $h->{_ATTRIBUTE_ORDER} = \@order; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 2 | $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | 0 | ▶ | , NODE_TYPE => sub { my ($xml, $h) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | 0 | ▶ | $h = { _ => $h } if ref $h ne 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | 0 | $h->{_NODE_TYPE} = type_of_node $xml; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | 0 | $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | 45 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | sub _decodeAfter($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | 13 | ▶ | { my ($self, $path, $call) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decodeAfter: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | 13 | ▶ | return $call if ref $call eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | # The 'after' can be called on a single. In that case, turn it into | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | # a HASH for additional information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 6 | ▶ | my $dec = $after{$call} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | or error __x"labeled after hook `{call}' undefined for READER" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | , call=> $call; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 6 | $dec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | sub makeBlocked($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | 19 | ▶ | { my ($self, $where, $class, $type) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeBlocked: called CC=6 SCAR=18.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 19 | ▶ | my $err_type = $self->prefixed($type) || $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->prefixed($type) || $type
MC/DC0%0/2
$self->prefixed($type) || $type
$self->prefixed($type)
$type
Truth table33%1/3
A || B
A= $self->prefixed($type)B= $type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | # errors are produced in class=misfit to allow other choices to succeed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | $class eq 'anyType' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 5 | ▶ | ? { st => sub { error __x"use of `{type}' blocked at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | , type => $err_type, where => $where, _class => 'misfit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | : $class eq 'simpleType' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | 2 | ▶ | ? { st => sub { error __x"use of {class} `{type}' blocked at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | , class => $class, type => $err_type, where => $where | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | , _class => 'misfit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | : $class eq 'complexType' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | ? { elems => [] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | : $class eq 'ref' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 0 | ▶ | ? { st => sub { error __x"use of referenced `{type}' blocked at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | , type => $err_type, where => $where, _class => 'misfit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 19 | ▶ | : panic "blocking of $class for $type not implemented"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | #----------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | 45 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||