| 1 | 10 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 10 | ▶ | no warnings qw(uninitialized); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | #================================================================ | ||||||||||||||||||||||||||||||||||||||||||
| 7 | package XML::Pastor::Schema::Object; | ||||||||||||||||||||||||||||||||||||||||||
| 8 | 10 | ▶ | use base qw (Class::Accessor); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 10 | XML::Pastor::Schema::Object->mk_accessors(qw(class definition documentation isRedefinable metaClass name nameIsAutoGenerated ref refKey scope type targetNamespace)); | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | #------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 13 | 306 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 306 | my $proto = shift; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 306 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
CORE::ref $proto || $proto
MC/DC0%0/2
CORE::ref $proto || $proto
CORE::ref $proto
$proto
Truth table33%1/3
A || B
A= CORE::ref $protoB= $proto
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 306 | my $self = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 306 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | #------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 151 | ▶ | sub key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
key: called CC=6 SCAR=19.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 151 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 151 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | return ($self->{key}=shift) | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 26 | 151 | ▶ | if ( exists $self->{key}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | return $self->{key}; | |||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | # WAS | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # return $self->name; | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | # Let's take a ride towards namespace support | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 151 | my $name = $self->name; | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 151 | ▶ | return $name if ($name =~ /\|/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 151 | ▶ | my $ns = $self->targetNamespace || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->targetNamespace || ''
MC/DC100%1/1
$self->targetNamespace || ''
$self->targetNamespace
Truth table100%2/2
A
A= $self->targetNamespace
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 151 | ▶ | return $self->name . ($ns ? '|' . $ns : ""); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | #------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 40 | ▶ | sub refKey { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refKey: called CC=7 SCAR=21.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 40 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 40 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | return ($self->{refKey}=shift) | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 48 | 40 | ▶ | if ( exists $self->{refKey}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | return $self->{refKey}; | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | # WAS | ||||||||||||||||||||||||||||||||||||||||||
| 53 | # return $self->ref(); | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | # Let's take a ride towards namespace support | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 40 | ▶ | return undef unless $self->ref(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 40 | my $ref = $self->ref; | |||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 40 | ▶ | return $ref if ($ref =~ /\|/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 20 | ▶ | my $ns = $self->targetNamespace || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->targetNamespace || ''
MC/DC0%0/1
$self->targetNamespace || ''
$self->targetNamespace
Truth table50%1/2
A
A= $self->targetNamespace
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 20 | ▶ | return $self->ref() . ($ns ? '|' . $ns : ""); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | #------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 67 | # Set multiple fields (hash values) of this object all at once from a given | ||||||||||||||||||||||||||||||||||||||||||
| 68 | # hash. | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 554 | ▶ | sub setFields { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setFields: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 554 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 554 | my $h = $_[0]; # if the first argument is a hash-ref, use it. | |||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | # otherwise, use the argument list as a hash. | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 554 | ▶ | unless (ref($h) =~ /HASH/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 18 | $h = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 554 | ▶ | while (my ($key, $value) = each %$h) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 801 | $self->{$key} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 554 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | #---------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 84 | # override the accessor -- only for GET. | ||||||||||||||||||||||||||||||||||||||||||
| 85 | # Default to the value in "definition" if there is one. | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 872 | ▶ | sub class { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
class: called CC=6 SCAR=27.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 872 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | # _class_accesor is an alias for class() made by Class::Accessor | ||||||||||||||||||||||||||||||||||||||||||
| 90 | # We are not interested by the SET case which should do the default. | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 872 | ▶ | return $self->_class_accessor(@_) if (@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | # if we have it defined here, just return it. | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 475 | my $result = $self->_class_accessor(); | |||||||||||||||||||||||||||||||||||||||||
| 95 | 475 | ▶ | return $result if $result; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | # Otherwise, see if our "definition" has it. So we would effectively delegate. | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my $definition = undef; | |||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | return $result unless (UNIVERSAL::can($self, "definition") && ($definition=$self->definition) && UNIVERSAL::can($definition, "class")); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
UNIVERSAL::can($self, "definition") and $definition = $self->definition and UNIVERSAL::can($definition, "class")
UNIVERSAL::can($self, "definition") and $definition = $self->definition
MC/DC0%0/3
UNIVERSAL::can($self, "definition") and $definition = $self->definition and UNIVERSAL::can($definition, "class")
UNIVERSAL::can($self, "definition")
$definition = $self->definition
UNIVERSAL::can($definition, "class")
Truth table0%0/4
A and B and C
A= UNIVERSAL::can($self, "definition")B= $definition = $self->definitionC= UNIVERSAL::can($definition, "class")
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | return $definition->class(); | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | #---------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 104 | # override the accessor -- only for GET. | ||||||||||||||||||||||||||||||||||||||||||
| 105 | # Default to the value in "definition" if there is one. | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 542 | ▶ | sub type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=6 SCAR=18.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 542 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | # _type_accesor is an alias for type() made by Class::Accessor | ||||||||||||||||||||||||||||||||||||||||||
| 110 | # We are not interested by the SET case which should do the default. | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 542 | ▶ | return $self->_type_accessor(@_) if (@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | # if we have it defined here, just return it. | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 542 | my $result = $self->_type_accessor(); | |||||||||||||||||||||||||||||||||||||||||
| 115 | 542 | ▶ | return $result if $result; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | # Otherwise, see if our "definition" has it. So we would effectively delegate. | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 84 | my $definition = undef; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 84 | ▶ | return $result unless (UNIVERSAL::can($self, "definition") && ($definition=$self->definition) && UNIVERSAL::can($definition, "type")); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
UNIVERSAL::can($self, "definition") and $definition = $self->definition and UNIVERSAL::can($definition, "type")
UNIVERSAL::can($self, "definition") and $definition = $self->definition
MC/DC33%1/3
UNIVERSAL::can($self, "definition") and $definition = $self->definition and UNIVERSAL::can($definition, "type")
UNIVERSAL::can($self, "definition")
$definition = $self->definition
UNIVERSAL::can($definition, "type")
Truth table50%2/4
A and B and C
A= UNIVERSAL::can($self, "definition")B= $definition = $self->definitionC= UNIVERSAL::can($definition, "type")
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 78 | return $definition->type(); | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 10 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | __END__ | ||||||||||||||||||||||||||||||||||||||||||