| 1 | #============================================================= -*-perl-*- | ||||||||||||||||||||
| 2 | # | ||||||||||||||||||||
| 3 | # XML::Schema::Type::Complex | ||||||||||||||||||||
| 4 | # | ||||||||||||||||||||
| 5 | # DESCRIPTION | ||||||||||||||||||||
| 6 | # Module implementing an object class for representing complex XML | ||||||||||||||||||||
| 7 | # Schema datatypes. Complex types are those that contain other | ||||||||||||||||||||
| 8 | # elements and/or carry attributes. | ||||||||||||||||||||
| 9 | # | ||||||||||||||||||||
| 10 | # AUTHOR | ||||||||||||||||||||
| 11 | # Andy Wardley <abw@kfs.org> | ||||||||||||||||||||
| 12 | # | ||||||||||||||||||||
| 13 | # COPYRIGHT | ||||||||||||||||||||
| 14 | # Copyright (C) 2001 Canon Research Centre Europe Ltd. | ||||||||||||||||||||
| 15 | # All Rights Reserved. | ||||||||||||||||||||
| 16 | # | ||||||||||||||||||||
| 17 | # This module is free software; you can redistribute it and/or | ||||||||||||||||||||
| 18 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||
| 19 | # | ||||||||||||||||||||
| 20 | # REVISION | ||||||||||||||||||||
| 21 | # $Id: Complex.pm,v 1.2 2001/12/20 13:26:28 abw Exp $ | ||||||||||||||||||||
| 22 | # | ||||||||||||||||||||
| 23 | #======================================================================== | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | package XML::Schema::Type::Complex; | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 28 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 28 | 28 | ▶ | use XML::Schema; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 29 | 28 | ▶ | use XML::Schema::Type; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 30 | 28 | ▶ | use XML::Schema::Scope; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 31 | 28 | ▶ | use XML::Schema::Scheduler; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 32 | 28 | ▶ | use base qw( XML::Schema::Scope XML::Schema::Type XML::Schema::Scheduler ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 33 | 28 | ▶ | use vars qw( $VERSION $DEBUG $ERROR @OPTIONAL @SCHEDULES ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 28 | $VERSION = sprintf("%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/); | |||||||||||||||||||
| 36 | 28 | ▶ | $DEBUG = 0 unless defined $DEBUG; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 37 | 28 | $ERROR = ''; | |||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 28 | @OPTIONAL = qw( annotation mixed scope ); | |||||||||||||||||||
| 40 | 28 | @SCHEDULES = qw( start_element end_element start_child end_child text ); | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 28 | ▶ | sub init { | ||||||||||||||||||
|
Subroutine
init: called CC=15 SCAR=28.7
Pod
documented
| |||||||||||||||||||||
| 44 | 28 | my ($self, $config) = @_; | |||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 28 | ▶ | $self->SUPER::init($config) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 47 | || return; | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | # set by base class (Scope) constructor | ||||||||||||||||||||
| 50 | 28 | my $factory = $self->{ _FACTORY }; | |||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | # tell attribute group to delegate to $self for types | ||||||||||||||||||||
| 53 | 28 | ▶ | $config->{ scope } ||= $self; | ||||||||||||||||||
|
Condition66%2/3
$config->{"scope"} ||= $self
MC/DC0%0/2
$config->{"scope"} ||= $self
$config->{"scope"}
$self
Truth table66%2/3
A ||= B
A= $config->{"scope"}B= $self
| |||||||||||||||||||||
| 54 | 28 | ▶ | $config->{ name } ||= 'anon'; | ||||||||||||||||||
|
Condition100%2/2
$config->{"name"} ||= "anon"
MC/DC100%1/1
$config->{"name"} ||= "anon"
$config->{"name"}
Truth table100%2/2
A
A= $config->{"name"}
| |||||||||||||||||||||
| 55 | 28 | $config->{ name } = '_complex_type_$config->{ name }'; | |||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | # create attribute group to manage attributes | ||||||||||||||||||||
| 58 | 28 | ▶ | $self->{ attributes } = $factory->create( attribute_group => $config ) | ||||||||||||||||||
|
Condition50%1/2
$factory->create('attribute_group', $config) || (return $self->error($factory->error))
MC/DC0%0/1
$factory->create('attribute_group', $config) || (return $self->error($factory->error))
$factory->create('attribute_group', $config)
Truth table50%1/2
A
A= $factory->create('attribute_group', $config)
| |||||||||||||||||||||
| 59 | || return $self->error($factory->error()); | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | # initialise scheduler | ||||||||||||||||||||
| 62 | 28 | ▶ | $self->init_scheduler($config) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 63 | || return; | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | # required ?? | ||||||||||||||||||||
| 66 | 28 | $self->{ simple } = 0; | |||||||||||||||||||
| 67 | 28 | $self->{ complex } = 1; | |||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | 28 | my $content; | |||||||||||||||||||
| 70 | 28 | ▶ | if ($content = $config->{ content }) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 71 | 1 | ▶ | if ($factory->isa( content => $content )) { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 72 | 0 | return $content; | |||||||||||||||||||
| 73 | } | ||||||||||||||||||||
| 74 | elsif ($content = $factory->create( content => $content )) { | ||||||||||||||||||||
| 75 | 1 | $self->{ content } = $content; | |||||||||||||||||||
| 76 | } | ||||||||||||||||||||
| 77 | else { | ||||||||||||||||||||
| 78 | 0 | return $self->error($factory->error()); | |||||||||||||||||||
| 79 | } | ||||||||||||||||||||
| 80 | } | ||||||||||||||||||||
| 81 | else { | ||||||||||||||||||||
| 82 | # TODO: this is laborious, need to find a better way | ||||||||||||||||||||
| 83 | 27 | ▶ | my $ctype = $factory->module('content') | ||||||||||||||||||
|
Condition50%1/2
$factory->module('content') || (return $self->error($factory->error))
MC/DC0%0/1
$factory->module('content') || (return $self->error($factory->error))
$factory->module('content')
Truth table50%1/2
A
A= $factory->module('content')
| |||||||||||||||||||||
| 84 | || return $self->error($factory->error()); | ||||||||||||||||||||
| 85 | 27 | ▶ | $factory->load($ctype) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 86 | || return $self->error($factory->error()); | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | 27 | ▶ | my $ptype = $factory->module('particle') | ||||||||||||||||||
|
Condition50%1/2
$factory->module('particle') || (return $self->error($factory->error))
MC/DC0%0/1
$factory->module('particle') || (return $self->error($factory->error))
$factory->module('particle')
Truth table50%1/2
A
A= $factory->module('particle')
| |||||||||||||||||||||
| 89 | || return $self->error($factory->error()); | ||||||||||||||||||||
| 90 | 27 | ▶ | $factory->load($ptype) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 91 | || return $self->error($factory->error()); | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | 27 | my $regex = join('|', $ctype->args(), $ptype->models()); | |||||||||||||||||||
| 94 | 27 | ▶ | if (grep(/^$regex$/, keys %$config)) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 95 | # create content model | ||||||||||||||||||||
| 96 | 24 | ▶ | $self->{ content } = $factory->create( content => $config ) | ||||||||||||||||||
|
Condition100%2/2
$factory->create('content', $config) || (return $self->error($factory->error))
MC/DC100%1/1
$factory->create('content', $config) || (return $self->error($factory->error))
$factory->create('content', $config)
Truth table100%2/2
A
A= $factory->create('content', $config)
| |||||||||||||||||||||
| 97 | || return $self->error($factory->error()); | ||||||||||||||||||||
| 98 | } | ||||||||||||||||||||
| 99 | } | ||||||||||||||||||||
| 100 | |||||||||||||||||||||
| 101 | 26 | return $self; | |||||||||||||||||||
| 102 | } | ||||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 106 | # attribute( ... ) | ||||||||||||||||||||
| 107 | # | ||||||||||||||||||||
| 108 | # Accessor method to fetch and update attributes. Delegates to | ||||||||||||||||||||
| 109 | # equivalent method of internal $self->{ attributes } attribute group | ||||||||||||||||||||
| 110 | # object. | ||||||||||||||||||||
| 111 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | 18 | ▶ | sub attribute { | ||||||||||||||||||
|
Subroutine
attribute: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 114 | 18 | my $self = shift; | |||||||||||||||||||
| 115 | 18 | my $agroup = $self->{ attributes }; | |||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | 18 | ▶ | return $agroup->attribute(@_) | ||||||||||||||||||
|
Condition66%2/3
$agroup->attribute(@_) || $self->error($agroup->error)
MC/DC50%1/2
$agroup->attribute(@_) || $self->error($agroup->error)
$agroup->attribute(@_)
$self->error($agroup->error)
Truth table66%2/3
A || B
A= $agroup->attribute(@_)B= $self->error($agroup->error)
| |||||||||||||||||||||
| 118 | || $self->error($agroup->error()); | ||||||||||||||||||||
| 119 | } | ||||||||||||||||||||
| 120 | |||||||||||||||||||||
| 121 | |||||||||||||||||||||
| 122 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 123 | # attributes( ) | ||||||||||||||||||||
| 124 | # | ||||||||||||||||||||
| 125 | # Returns reference to the internal XML::Schema::Attribute::Group object | ||||||||||||||||||||
| 126 | # which manages attributes. | ||||||||||||||||||||
| 127 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | 1 | ▶ | sub attributes { | ||||||||||||||||||
|
Subroutine
attributes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 130 | 1 | my $self = shift; | |||||||||||||||||||
| 131 | 1 | return $self->{ attributes }; | |||||||||||||||||||
| 132 | } | ||||||||||||||||||||
| 133 | |||||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 136 | # content() | ||||||||||||||||||||
| 137 | # | ||||||||||||||||||||
| 138 | # Return a reference to the current content model object. Creates a | ||||||||||||||||||||
| 139 | # new content object via the current factory if called with | ||||||||||||||||||||
| 140 | # arguments. | ||||||||||||||||||||
| 141 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 142 | |||||||||||||||||||||
| 143 | 26 | ▶ | sub content { | ||||||||||||||||||
|
Subroutine
content: called CC=4 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||
| 144 | 26 | my $self = shift; | |||||||||||||||||||
| 145 | 26 | ▶ | return $self->{ content } unless @_; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | my $factory = $self->{ _FACTORY } | ||||||||||||||||||||
| 148 | 2 | ▶ | || return $self->error("no factory defined"); | ||||||||||||||||||
|
Condition50%1/2
$self->{'_FACTORY'} || (return $self->error('no factory defined'))
MC/DC0%0/1
$self->{'_FACTORY'} || (return $self->error('no factory defined'))
$self->{'_FACTORY'}
Truth table50%1/2
A
A= $self->{'_FACTORY'}
| |||||||||||||||||||||
| 149 | |||||||||||||||||||||
| 150 | 2 | ▶ | $self->{ content } = $factory->create( content => @_ ) | ||||||||||||||||||
|
Condition50%1/2
$factory->create('content', @_) || (return $self->error($factory->error))
MC/DC0%0/1
$factory->create('content', @_) || (return $self->error($factory->error))
$factory->create('content', @_)
Truth table50%1/2
A
A= $factory->create('content', @_)
| |||||||||||||||||||||
| 151 | || return $self->error($factory->error()); | ||||||||||||||||||||
| 152 | } | ||||||||||||||||||||
| 153 | |||||||||||||||||||||
| 154 | |||||||||||||||||||||
| 155 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 156 | # sequence( @items ) | ||||||||||||||||||||
| 157 | # | ||||||||||||||||||||
| 158 | # Used to create a sequence content model, e.g. | ||||||||||||||||||||
| 159 | # | ||||||||||||||||||||
| 160 | # <complexType name="personType"> | ||||||||||||||||||||
| 161 | # <sequence> | ||||||||||||||||||||
| 162 | # <element name="name" type="string"/> | ||||||||||||||||||||
| 163 | # <element name="email" type="string"/> | ||||||||||||||||||||
| 164 | # </sequence> | ||||||||||||||||||||
| 165 | # </complextype> | ||||||||||||||||||||
| 166 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 167 | |||||||||||||||||||||
| 168 | 1 | ▶ | sub sequence { | ||||||||||||||||||
|
Subroutine
sequence: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 169 | 1 | my $self = shift; | |||||||||||||||||||
| 170 | 1 | my $content = { }; | |||||||||||||||||||
| 171 | |||||||||||||||||||||
| 172 | 1 | ▶ | while (! ref $_[0]) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 173 | 2 | my $key = shift; | |||||||||||||||||||
| 174 | 2 | $content->{ $key } = shift; | |||||||||||||||||||
| 175 | } | ||||||||||||||||||||
| 176 | 1 | $content->{ sequence } = [ @_ ]; | |||||||||||||||||||
| 177 | |||||||||||||||||||||
| 178 | 1 | ▶ | $self->TRACE("content => ", $content) if $DEBUG; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 179 | 1 | $self->content($content); | |||||||||||||||||||
| 180 | } | ||||||||||||||||||||
| 181 | |||||||||||||||||||||
| 182 | |||||||||||||||||||||
| 183 | |||||||||||||||||||||
| 184 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 185 | # choice( @items ) | ||||||||||||||||||||
| 186 | # | ||||||||||||||||||||
| 187 | # Used to create a choice content model, e.g. | ||||||||||||||||||||
| 188 | # | ||||||||||||||||||||
| 189 | # <complexType name="personType"> | ||||||||||||||||||||
| 190 | # <choice> | ||||||||||||||||||||
| 191 | # <element name="employee" type="employeeType"/> | ||||||||||||||||||||
| 192 | # <element name="customer" type="customerType"/> | ||||||||||||||||||||
| 193 | # </choice> | ||||||||||||||||||||
| 194 | # </complextype> | ||||||||||||||||||||
| 195 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 196 | |||||||||||||||||||||
| 197 | 1 | ▶ | sub choice { | ||||||||||||||||||
|
Subroutine
choice: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 198 | 1 | my $self = shift; | |||||||||||||||||||
| 199 | 1 | my $content = { }; | |||||||||||||||||||
| 200 | |||||||||||||||||||||
| 201 | 1 | ▶ | while (! ref $_[0]) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 202 | 2 | my $key = shift; | |||||||||||||||||||
| 203 | 2 | $content->{ $key } = shift; | |||||||||||||||||||
| 204 | } | ||||||||||||||||||||
| 205 | 1 | $content->{ choice } = [ @_ ]; | |||||||||||||||||||
| 206 | |||||||||||||||||||||
| 207 | 1 | ▶ | $self->TRACE("choice => ", $content) if $DEBUG; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 208 | 1 | $self->content($content); | |||||||||||||||||||
| 209 | } | ||||||||||||||||||||
| 210 | |||||||||||||||||||||
| 211 | |||||||||||||||||||||
| 212 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 213 | # simpleContent( @items ) | ||||||||||||||||||||
| 214 | # | ||||||||||||||||||||
| 215 | # Used to create a simpleContent model for the complexType, e.g. | ||||||||||||||||||||
| 216 | # | ||||||||||||||||||||
| 217 | # <price currency="EUR">3.14</price> | ||||||||||||||||||||
| 218 | # | ||||||||||||||||||||
| 219 | # <element name="price" type="internationalPrice"/> | ||||||||||||||||||||
| 220 | # <complexType name="internationalPrice"> | ||||||||||||||||||||
| 221 | # <simpleContent> <---- simpleContent() | ||||||||||||||||||||
| 222 | # <extension base="decimal"> | ||||||||||||||||||||
| 223 | # <attribute name="currency" type="string"/> | ||||||||||||||||||||
| 224 | # </extension> | ||||||||||||||||||||
| 225 | # </simpleContent> | ||||||||||||||||||||
| 226 | # </complexType> | ||||||||||||||||||||
| 227 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 228 | |||||||||||||||||||||
| 229 | 0 | ▶ | sub simpleContent { | ||||||||||||||||||
|
Subroutine
simpleContent: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 230 | 0 | my $self = shift; | |||||||||||||||||||
| 231 | 0 | $self->throw('simpleContent() not yet implemented'); | |||||||||||||||||||
| 232 | } | ||||||||||||||||||||
| 233 | |||||||||||||||||||||
| 234 | |||||||||||||||||||||
| 235 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 236 | # complexContent( @items ) | ||||||||||||||||||||
| 237 | # | ||||||||||||||||||||
| 238 | # Used to create a complexContent model for the complexType, e.g. | ||||||||||||||||||||
| 239 | # | ||||||||||||||||||||
| 240 | # <price currency="EUR" value="3.14"/> | ||||||||||||||||||||
| 241 | # | ||||||||||||||||||||
| 242 | # <element name="price" type="internationalPrice"/> | ||||||||||||||||||||
| 243 | # <complexType name="internationalPrice"> | ||||||||||||||||||||
| 244 | # <complexContent> <---- complexContent() | ||||||||||||||||||||
| 245 | # <restriction base="anyType"> | ||||||||||||||||||||
| 246 | # <attribute name="currency" type="string"/> | ||||||||||||||||||||
| 247 | # <attribute name="value" type="decimal"/> | ||||||||||||||||||||
| 248 | # </restriction> | ||||||||||||||||||||
| 249 | # </complexContent> | ||||||||||||||||||||
| 250 | # </complexType> | ||||||||||||||||||||
| 251 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 252 | |||||||||||||||||||||
| 253 | 0 | ▶ | sub complexContent { | ||||||||||||||||||
|
Subroutine
complexContent: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 254 | 0 | my $self = shift; | |||||||||||||||||||
| 255 | 0 | $self->throw('complexContent() not yet implemented'); | |||||||||||||||||||
| 256 | } | ||||||||||||||||||||
| 257 | |||||||||||||||||||||
| 258 | |||||||||||||||||||||
| 259 | #======================================================================== | ||||||||||||||||||||
| 260 | # misc accessor methods | ||||||||||||||||||||
| 261 | #======================================================================== | ||||||||||||||||||||
| 262 | |||||||||||||||||||||
| 263 | 0 | ▶ | sub annotation { | ||||||||||||||||||
|
Subroutine
annotation: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 264 | 0 | my $self = shift; | |||||||||||||||||||
| 265 | 0 | ▶ | return @_ ? ($self->{ annotation } = shift) : $self->{ annotation }; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 266 | } | ||||||||||||||||||||
| 267 | |||||||||||||||||||||
| 268 | 0 | ▶ | sub simple { | ||||||||||||||||||
|
Subroutine
simple: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 269 | 0 | return 0; | |||||||||||||||||||
| 270 | } | ||||||||||||||||||||
| 271 | |||||||||||||||||||||
| 272 | 0 | ▶ | sub complex { | ||||||||||||||||||
|
Subroutine
complex: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 273 | 0 | return 1; | |||||||||||||||||||
| 274 | } | ||||||||||||||||||||
| 275 | |||||||||||||||||||||
| 276 | 17 | ▶ | sub mixed { | ||||||||||||||||||
|
Subroutine
mixed: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 277 | 17 | my $self = shift; | |||||||||||||||||||
| 278 | my $content = $self->{ content } | ||||||||||||||||||||
| 279 | 17 | ▶ | || return $self->error("no content defined"); | ||||||||||||||||||
|
Condition100%2/2
$self->{'content'} || (return $self->error('no content defined'))
MC/DC100%1/1
$self->{'content'} || (return $self->error('no content defined'))
$self->{'content'}
Truth table100%2/2
A
A= $self->{'content'}
| |||||||||||||||||||||
| 280 | 16 | return $content->mixed(@_); | |||||||||||||||||||
| 281 | } | ||||||||||||||||||||
| 282 | |||||||||||||||||||||
| 283 | 1 | ▶ | sub empty { | ||||||||||||||||||
|
Subroutine
empty: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||
| 284 | 1 | my $self = shift; | |||||||||||||||||||
| 285 | my $content = $self->{ content } | ||||||||||||||||||||
| 286 | 1 | ▶ | || return $self->error("no content defined"); | ||||||||||||||||||
|
Condition50%1/2
$self->{'content'} || (return $self->error('no content defined'))
MC/DC0%0/1
$self->{'content'} || (return $self->error('no content defined'))
$self->{'content'}
Truth table50%1/2
A
A= $self->{'content'}
| |||||||||||||||||||||
| 287 | 1 | return $content->empty(@_); | |||||||||||||||||||
| 288 | } | ||||||||||||||||||||
| 289 | |||||||||||||||||||||
| 290 | 5 | ▶ | sub element_only { | ||||||||||||||||||
|
Subroutine
element_only: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||
| 291 | 5 | my $self = shift; | |||||||||||||||||||
| 292 | my $content = $self->{ content } | ||||||||||||||||||||
| 293 | 5 | ▶ | || return $self->error("no content defined"); | ||||||||||||||||||
|
Condition50%1/2
$self->{'content'} || (return $self->error('no content defined'))
MC/DC0%0/1
$self->{'content'} || (return $self->error('no content defined'))
$self->{'content'}
Truth table50%1/2
A
A= $self->{'content'}
| |||||||||||||||||||||
| 294 | 5 | return $content->element_only(@_); | |||||||||||||||||||
| 295 | } | ||||||||||||||||||||
| 296 | |||||||||||||||||||||
| 297 | #======================================================================== | ||||||||||||||||||||
| 298 | # parser methods | ||||||||||||||||||||
| 299 | #======================================================================== | ||||||||||||||||||||
| 300 | |||||||||||||||||||||
| 301 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 302 | # handler($instance, $element) | ||||||||||||||||||||
| 303 | # | ||||||||||||||||||||
| 304 | # Calls the complex_handler($self, $element) method on the $instance | ||||||||||||||||||||
| 305 | # reference. | ||||||||||||||||||||
| 306 | # | ||||||||||||||||||||
| 307 | # TODO: we could optimise away this chain of method calls by having the | ||||||||||||||||||||
| 308 | # instance Start() method unwrap the calls. | ||||||||||||||||||||
| 309 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 310 | |||||||||||||||||||||
| 311 | 0 | ▶ | sub handler { | ||||||||||||||||||
|
Subroutine
handler: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 312 | 0 | my ($self, $instance, $element) = @_; | |||||||||||||||||||
| 313 | 0 | ▶ | return $instance->complex_handler($self, $element) | ||||||||||||||||||
|
Condition0%0/3
$instance->complex_handler($self, $element) || $self->error($instance->error)
MC/DC0%0/2
$instance->complex_handler($self, $element) || $self->error($instance->error)
$instance->complex_handler($self, $element)
$self->error($instance->error)
Truth table0%0/3
A || B
A= $instance->complex_handler($self, $element)B= $self->error($instance->error)
| |||||||||||||||||||||
| 314 | || $self->error($instance->error()); | ||||||||||||||||||||
| 315 | } | ||||||||||||||||||||
| 316 | |||||||||||||||||||||
| 317 | 0 | ▶ | sub present { | ||||||||||||||||||
|
Subroutine
present: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 318 | 0 | my ($self, $view) = @_; | |||||||||||||||||||
| 319 | 0 | $view->view( complex => $self ); | |||||||||||||||||||
| 320 | } | ||||||||||||||||||||
| 321 | |||||||||||||||||||||
| 322 | 0 | ▶ | sub ID { | ||||||||||||||||||
|
Subroutine
ID: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 323 | 0 | my $self = shift; | |||||||||||||||||||
| 324 | 0 | return 'ComplexType'; | |||||||||||||||||||
| 325 | } | ||||||||||||||||||||
| 326 | |||||||||||||||||||||
| 327 | 28 | 1; | |||||||||||||||||||
| 328 | |||||||||||||||||||||
| 329 | __END__ | ||||||||||||||||||||