| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # $Id$ | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # $Author$ | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # $HeadURL$ | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # $Date$ | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # $Revision$ | ||||||||||||||||||||||||||||||||||||||||||
| 7 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | { | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | package OOP::Perlish::Class::Accessor; | ||||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | our $VERSION = 0.0100; | |||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use Scalar::Util qw(weaken blessed); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 7 | ▶ | use Carp qw(confess); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 7 | ▶ | use OOP::Perlish::Class::Abstract; # for implementation method exclusion | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | ##########************************************************************************########## | ||||||||||||||||||||||||||||||||||||||||||
| 21 | #!!!!!!!!! BEGIN Inherit constructor from OOP::Perlish::Class; and overload methods associated | ||||||||||||||||||||||||||||||||||||||||||
| 22 | #!!!!!!!!! with accessors (because we are accessors...) | ||||||||||||||||||||||||||||||||||||||||||
| 23 | ##########************************************************************************########## | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 26 | ## We override ____OOP_PERLISH_CLASS_REQUIRED_FIELDS, _accessors, ___inherit_accessors, and | ||||||||||||||||||||||||||||||||||||||||||
| 27 | ## ___OOP_PERLISH_CLASS__ACCESSORS below | ||||||||||||||||||||||||||||||||||||||||||
| 28 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 7 | ▶ | use base 'OOP::Perlish::Class'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 32 | ## We must override __OOP_PERLISH_CLASS__REQUIRED_FIELDS because we will not initialize required fileds | ||||||||||||||||||||||||||||||||||||||||||
| 33 | ## via _accessors in the normal way | ||||||||||||||||||||||||||||||||||||||||||
| 34 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 35 | sub ____OOP_PERLISH_CLASS_REQUIRED_FIELDS | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 368 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
____OOP_PERLISH_CLASS_REQUIRED_FIELDS: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 368 | return ( [qw(name type)] ); | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 41 | ## We are accessors, we cannot inherit them | ||||||||||||||||||||||||||||||||||||||||||
| 42 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 43 | sub ____inherit_accessors | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 92 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
____inherit_accessors: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 92 | return; | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 49 | ## We are accessors, we cannot have accessors. | ||||||||||||||||||||||||||||||||||||||||||
| 50 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 51 | sub ____OOP_PERLISH_CLASS_ACCESSORS | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 183 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
____OOP_PERLISH_CLASS_ACCESSORS: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 183 | return {}; | |||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 57 | ## We are accessors, we cannot have accessors. | ||||||||||||||||||||||||||||||||||||||||||
| 58 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 59 | sub _accessors | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_accessors: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | ##########************************************************************************########## | ||||||||||||||||||||||||||||||||||||||||||
| 65 | #!!!!!!!!! END overloads/inheritance from OOP::Perlish::Class | ||||||||||||||||||||||||||||||||||||||||||
| 66 | ##########************************************************************************########## | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 69 | ## get/set the value stored in this accessor. | ||||||||||||||||||||||||||||||||||||||||||
| 70 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 71 | sub value | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 299 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
value: called CC=5 SCAR=17.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 299 | my ( $self, @values ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 299 | ▶ | if( @values && ( $self->readonly() && $self->self()->{__initialized} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
@values and ($self->readonly and $self->self->{"__initialized"})
$self->readonly and $self->self->{"__initialized"}
MC/DC0%0/3
@values and ($self->readonly and $self->self->{"__initialized"})
@values
$self->readonly
$self->self->{"__initialized"}
Truth table50%2/4
A and B and C
A= @valuesB= $self->readonlyC= $self->self->{"__initialized"}
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | carp( 'Cannot set ' . $self->name() . 'With ' . Dumper( \@values ) . 'Because it is readonly and we\'re already initialized' ); | |||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 299 | ▶ | if(@values) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 132 | $self->__set_value(@values); | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 299 | return $self->__get_value(); | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 86 | ## determine if a value (even undef) has been set on this accessor for a specific instance | ||||||||||||||||||||||||||||||||||||||||||
| 87 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 88 | sub is_set | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 397 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_set: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 397 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 397 | ▶ | return( (defined($self->self()->{___fields}->{ $self->name() }->{_Set})) ? $self->self()->{___fields}->{ $self->name() }->{_Set} : -1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 95 | ## get/set whether this should be treated as readonly after initialization | ||||||||||||||||||||||||||||||||||||||||||
| 96 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 97 | sub readonly | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 264 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readonly: called CC=4 SCAR=16.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 264 | my ( $self, $readonly ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 264 | ▶ | if( defined($readonly) && !exists( $self->{_readonly} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $readonly and not exists $self->{"_readonly"}
MC/DC0%0/2
defined $readonly and not exists $self->{"_readonly"}
defined $readonly
not exists $self->{"_readonly"}
Truth table33%1/3
A and not(B)
A= defined $readonlyB= not exists $self->{"_readonly"}
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $self->{_readonly} = $readonly; | |||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 264 | ▶ | $self->{_readonly} = undef unless( $self->{_readonly} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 264 | return $self->{_readonly}; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 109 | ## get/set the type of the data stored in this | ||||||||||||||||||||||||||||||||||||||||||
| 110 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 111 | sub type | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 1831 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=5 SCAR=16.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 1831 | my ( $self, $type ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 1831 | $type = uc($type); | |||||||||||||||||||||||||||||||||||||||||
| 115 | 1831 | ▶ | if($type) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 90 | ▶ | confess("Invalid type specified") unless( $self->__valid_type_lookup($type) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 89 | ▶ | if( !$self->{_Type} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 89 | $self->{_Type} = $type; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 89 | $self->base_type($type); | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 1830 | ▶ | return $self->{_Type} if( defined( $self->{_Type} ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 128 | ## get/set '$self' of this accessor to be used by ->validator() subroutines that need to see the class | ||||||||||||||||||||||||||||||||||||||||||
| 129 | ## for which we are an accessor of, rather than this accessor class itself. | ||||||||||||||||||||||||||||||||||||||||||
| 130 | ## In principal, this should only be set by the class which defines this accessor, but this is not enforced. | ||||||||||||||||||||||||||||||||||||||||||
| 131 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 132 | sub self | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 1968 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
self: called CC=6 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 1968 | my ( $self, $class_self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 1968 | ▶ | if( defined $class_self ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 315 | ▶ | confess('argument to ->self() is not a blessed reference') unless( ref($class_self) && blessed($class_self) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $class_self and builtin::blessed($class_self)
MC/DC0%0/2
ref $class_self and builtin::blessed($class_self)
ref $class_self
builtin::blessed($class_self)
Truth table33%1/3
A and B
A= ref $class_selfB= builtin::blessed($class_self)
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 315 | weaken($class_self); # weaken to avoid cyclic reference leaks | |||||||||||||||||||||||||||||||||||||||||
| 140 | 315 | ▶ | $self->{_class_self} = $class_self if( defined($class_self) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 1968 | ▶ | return $self->{_class_self} if( defined( $self->{_class_self} ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 147 | ## get/set the name of this accessor | ||||||||||||||||||||||||||||||||||||||||||
| 148 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 149 | sub name | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 1660 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 1660 | my ( $self, $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 1660 | ▶ | if( defined($name) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 89 | $self->{_name} = $name; | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 1660 | ▶ | return $self->{_name} if( defined( $self->{_name} ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 161 | ## get/set whether this is a required attribute to the constructor | ||||||||||||||||||||||||||||||||||||||||||
| 162 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 163 | sub required | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 70 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
required: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 70 | my ( $self, $required ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 70 | ▶ | if( defined($required) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 8 | $self->{_required} = $required; | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | 70 | ▶ | return $self->{_required} if( defined( $self->{_required} ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 45 | return; | |||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 175 | ## get/set the default value | ||||||||||||||||||||||||||||||||||||||||||
| 176 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 177 | sub default ## no critic (ProhibitBuiltinHomonyms) | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 30 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default: called CC=6 SCAR=19.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 30 | my ( $self, @values ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 30 | ▶ | if( @values && !$self->default_is_set() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@values and not $self->default_is_set
MC/DC100%2/2
@values and not $self->default_is_set
@values
not $self->default_is_set
Truth table100%3/3
A and not(B)
A= @valuesB= not $self->default_is_set
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 10 | $self->{_default_is_set} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 10 | ▶ | if( !defined( $values[0] ) && scalar @values == 1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $values[0] and scalar @values == 1
MC/DC0%0/2
not defined $values[0] and scalar @values == 1
not defined $values[0]
scalar @values == 1
Truth table33%1/3
not(A) and B
A= not defined $values[0]B= scalar @values == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $self->{_default} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 10 | ( $self->{_default} ) = $self->reference( $self->__dereference_always(@values) ); | |||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | 30 | ▶ | if( defined( $self->{_default} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 30 | return $self->dereference( $self->{_default} ); | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 197 | ## Specify whether we will permit direct mutation of this reference | ||||||||||||||||||||||||||||||||||||||||||
| 198 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 199 | sub mutable | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 62 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mutable: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 62 | my ($self, $mutable) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 62 | ▶ | if(defined($mutable)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 2 | $self->{_mutable} = $mutable; | |||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 62 | ▶ | if(defined($self->{_mutable})) { # && $self->type() && $self->type() =~ m/REF/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 8 | return $self->{_mutable}; | |||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 54 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 214 | ## Check if default value has been set | ||||||||||||||||||||||||||||||||||||||||||
| 215 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 216 | sub default_is_set | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 52 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_is_set: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 52 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 52 | return $self->{_default_is_set}; | |||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 224 | ## get the basetype of either the type of this object, or the type passed as an argument | ||||||||||||||||||||||||||||||||||||||||||
| 225 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 226 | sub base_type | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 274 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
base_type: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 274 | my ( $self, $type ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 229 | 274 | ▶ | $type ||= $self->type(); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$type ||= $self->type
MC/DC0%0/2
$type ||= $self->type
$type
$self->type
Truth table66%2/3
A ||= B
A= $typeB= $self->type
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 274 | ▶ | return $self->__valid_type_lookup($type) if( $self->__valid_type_lookup($type) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 235 | ## based on the type, and basetype of this object, dereferences (if necessary) the data | ||||||||||||||||||||||||||||||||||||||||||
| 236 | ## so that the requester obtains what they expect. | ||||||||||||||||||||||||||||||||||||||||||
| 237 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 238 | sub dereference | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 292 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dereference: called CC=18 SCAR=29.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 292 | my ( $self, $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 292 | for( $self->type() ) { | |||||||||||||||||||||||||||||||||||||||||
| 243 | 292 | ▶ | /REF/i && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | ## Re-reference with temporary storage to protect encapsulation unless defined as mutable | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 60 | ▶ | if(! $self->mutable()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | 54 | ▶ | /HASH/ && ref($ref) eq 'HASH' && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/HASH/ and ref $ref eq "HASH"
MC/DC50%1/2
/HASH/ and ref $ref eq "HASH"
/HASH/
ref $ref eq "HASH"
Truth table66%2/3
A and B
A= /HASH/B= ref $ref eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 18 | my %tmp = ( %{ $ref } ); | |||||||||||||||||||||||||||||||||||||||||
| 248 | 18 | return \%tmp; | |||||||||||||||||||||||||||||||||||||||||
| 249 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 36 | ▶ | /ARRAY/ && ref($ref) eq 'ARRAY' && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/ARRAY/ and ref $ref eq "ARRAY"
MC/DC50%1/2
/ARRAY/ and ref $ref eq "ARRAY"
/ARRAY/
ref $ref eq "ARRAY"
Truth table66%2/3
A and B
A= /ARRAY/B= ref $ref eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 15 | my @tmp = ( @{ $ref } ); | |||||||||||||||||||||||||||||||||||||||||
| 252 | 15 | return \@tmp; | |||||||||||||||||||||||||||||||||||||||||
| 253 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 254 | 21 | ▶ | /SCALAR/ && ref($ref) eq 'SCALAR' && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/SCALAR/ and ref $ref eq "SCALAR"
MC/DC50%1/2
/SCALAR/ and ref $ref eq "SCALAR"
/SCALAR/
ref $ref eq "SCALAR"
Truth table66%2/3
A and B
A= /SCALAR/B= ref $ref eq "SCALAR"
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 15 | my $tmp = ${$ref}; | |||||||||||||||||||||||||||||||||||||||||
| 256 | 15 | return \$tmp; | |||||||||||||||||||||||||||||||||||||||||
| 257 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | 12 | return $ref; | |||||||||||||||||||||||||||||||||||||||||
| 260 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 232 | ▶ | /CODE/i && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 17 | return $ref; | |||||||||||||||||||||||||||||||||||||||||
| 263 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 215 | ▶ | /OBJECT/ && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 21 | return $ref; | |||||||||||||||||||||||||||||||||||||||||
| 266 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 194 | ▶ | /HASH/ && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 28 | ▶ | return %{$ref} if( ref($ref) eq 'HASH' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 270 | 166 | ▶ | /ARRAY/ && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 28 | ▶ | return @{$ref} if( ref($ref) eq 'ARRAY' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 138 | ▶ | /SCALAR/ && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 128 | ▶ | return ${$ref} if( ref($ref) eq 'SCALAR' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 10 | return $ref; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 281 | ## based on the basetype and type of this object, created a reference to it for insertion into $self | ||||||||||||||||||||||||||||||||||||||||||
| 282 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 283 | sub reference | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 183 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reference: called CC=10 SCAR=23.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | 183 | my ( $self, @stuff ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 183 | for( $self->type() ) { | |||||||||||||||||||||||||||||||||||||||||
| 288 | 183 | ▶ | /^REF/ && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 8 | return $stuff[0]; | |||||||||||||||||||||||||||||||||||||||||
| 290 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 291 | 175 | ▶ | /CODE/i && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 6 | return $stuff[0]; | |||||||||||||||||||||||||||||||||||||||||
| 293 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 294 | 169 | ▶ | /GLOB/ && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | 4 | return $stuff[0]; | |||||||||||||||||||||||||||||||||||||||||
| 296 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 297 | 165 | ▶ | /REGEXP/i && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 3 | return $stuff[0]; | |||||||||||||||||||||||||||||||||||||||||
| 299 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 300 | 162 | ▶ | /OBJECT/ && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | 17 | return $stuff[0]; | |||||||||||||||||||||||||||||||||||||||||
| 302 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 145 | ▶ | /HASH/ && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 32 | return { (@stuff) }; | |||||||||||||||||||||||||||||||||||||||||
| 305 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 306 | 113 | ▶ | /ARRAY/ && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | 26 | return \@stuff; | |||||||||||||||||||||||||||||||||||||||||
| 308 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 87 | ▶ | /SCALAR/ && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 87 | return \$stuff[0]; | |||||||||||||||||||||||||||||||||||||||||
| 311 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | return; @stuff; | |||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 317 | ## set/get the validator sub-routine used for set operations of this accessor | ||||||||||||||||||||||||||||||||||||||||||
| 318 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 319 | sub validator | ||||||||||||||||||||||||||||||||||||||||||
| 320 | 465 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validator: called CC=6 SCAR=18.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 465 | my ( $self, $validator ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | 465 | ▶ | if( $validator && ref($validator) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$validator and ref $validator
MC/DC50%1/2
$validator and ref $validator
$validator
ref $validator
Truth table66%2/3
A and B
A= $validatorB= ref $validator
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | 47 | for( ref($validator) ) { | |||||||||||||||||||||||||||||||||||||||||
| 325 | 47 | ▶ | /CODE/i && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 11 | return ( $self->{_Validator} = $validator ); | |||||||||||||||||||||||||||||||||||||||||
| 327 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 328 | 36 | ▶ | /REGEXP/i && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | 36 | return ( $self->{_Validator} = $self->__regexp_sub_factory($validator) ); | |||||||||||||||||||||||||||||||||||||||||
| 330 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | return ( $self->{_Validator} = sub {return} ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||
| 334 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 418 | return $self->{_Validator}; | |||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 340 | ## get/set the classes an object must "is-a" to be valid as a value for this accessor | ||||||||||||||||||||||||||||||||||||||||||
| 341 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 342 | sub object_isa | ||||||||||||||||||||||||||||||||||||||||||
| 343 | 55 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
object_isa: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 55 | my ( $self, $classes ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | 55 | ▶ | if($classes) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 2 | ▶ | $classes = [$classes] unless( ref($classes) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 2 | $self->{_Object_Classes} = [ @{$classes} ]; | |||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 350 | 55 | ▶ | return @{ $self->{_Object_Classes} } if( defined( $self->{_Object_Classes} ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 354 | ## get/set the methods an object must "can" to be valid as a value for this accessor | ||||||||||||||||||||||||||||||||||||||||||
| 355 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 356 | sub object_can | ||||||||||||||||||||||||||||||||||||||||||
| 357 | 60 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
object_can: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | 60 | my ( $self, $interfaces ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 60 | ▶ | if($interfaces) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | 6 | ▶ | $interfaces = [$interfaces] unless( ref($interfaces) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | 6 | $self->{_Object_Interfaces} = [ @{$interfaces} ]; | |||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||
| 364 | 60 | ▶ | return @{ $self->{_Object_Interfaces} } if( defined( $self->{_Object_Interfaces} ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 368 | ## get/set the classes (packages) that an object must be like | ||||||||||||||||||||||||||||||||||||||||||
| 369 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 370 | sub implements | ||||||||||||||||||||||||||||||||||||||||||
| 371 | 58 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
implements: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 58 | my ( $self, $classes ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 58 | ▶ | if($classes) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 4 | ▶ | $classes = [$classes] unless( ref($classes) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | 4 | $self->{_Object_Implements} = [ @{$classes} ]; | |||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 378 | 58 | ▶ | return @{ $self->{_Object_Implements} } if( defined( $self->{_Object_Implements} ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | ##########************************************************************************########## | ||||||||||||||||||||||||||||||||||||||||||
| 382 | #!!!!!!!!! Internal foo | ||||||||||||||||||||||||||||||||||||||||||
| 383 | ##########************************************************************************########## | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 386 | ## Lookup a type and determin if its a) valid, and b) if it has a basetype | ||||||||||||||||||||||||||||||||||||||||||
| 387 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 388 | sub __valid_type_lookup | ||||||||||||||||||||||||||||||||||||||||||
| 389 | 638 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__valid_type_lookup: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 638 | my ( $self, $type ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | 638 | my %valid_types_map = ( | |||||||||||||||||||||||||||||||||||||||||
| 393 | SCALAR => 'SCALARREF', | ||||||||||||||||||||||||||||||||||||||||||
| 394 | ARRAY => 'ARRAYREF', | ||||||||||||||||||||||||||||||||||||||||||
| 395 | HASH => 'HASHREF', | ||||||||||||||||||||||||||||||||||||||||||
| 396 | CODE => 'CODEREF', | ||||||||||||||||||||||||||||||||||||||||||
| 397 | REF => 'REF', | ||||||||||||||||||||||||||||||||||||||||||
| 398 | GLOB => 'GLOBREF', | ||||||||||||||||||||||||||||||||||||||||||
| 399 | OBJECT => 'OBJECT', | ||||||||||||||||||||||||||||||||||||||||||
| 400 | Regexp => 'REGEXP', | ||||||||||||||||||||||||||||||||||||||||||
| 401 | # TODO: CLASS => 'CLASS', | ||||||||||||||||||||||||||||||||||||||||||
| 402 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 403 | 638 | my %valid_types_lut = reverse %valid_types_map; | |||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 638 | ▶ | if( exists( $valid_types_map{$type} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | 409 | return $type; | |||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||
| 408 | elsif( exists( $valid_types_lut{$type} ) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 409 | 228 | return $valid_types_lut{$type}; | |||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||
| 411 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 412 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 417 | ## Verify that a value specified as a default is valid for the accessor; this allows post-validation in object instantiation | ||||||||||||||||||||||||||||||||||||||||||
| 418 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 419 | sub __validate_default | ||||||||||||||||||||||||||||||||||||||||||
| 420 | 59 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__validate_default: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||
| 421 | 59 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 59 | ▶ | return unless( exists( $self->{_default} ) && $self->default_is_set() ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $self->{"_default"} and $self->default_is_set
MC/DC50%1/2
exists $self->{"_default"} and $self->default_is_set
exists $self->{"_default"}
$self->default_is_set
Truth table66%2/3
A and B
A= exists $self->{"_default"}B= $self->default_is_set
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 10 | my @orig_values = $self->__dereference_always( $self->{_default} ); | |||||||||||||||||||||||||||||||||||||||||
| 426 | 10 | my @valid_values = $self->__validate( $self->{_default} ); | |||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||
| 428 | 10 | ▶ | if( !@valid_values ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 429 | 5 | ▶ | confess( 'Invalid default value ' . ( (@orig_values) ? Dumper( \@orig_values ) : '`undef\'' ) . ' for field ' . $self->name() ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 5 | $self->{_default} = $self->reference(@valid_values); | |||||||||||||||||||||||||||||||||||||||||
| 433 | 5 | return; | |||||||||||||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 437 | ## Jump through requisite hoops to set a value; marking _Set appropriately for is_set method | ||||||||||||||||||||||||||||||||||||||||||
| 438 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 439 | sub __set_value | ||||||||||||||||||||||||||||||||||||||||||
| 440 | 132 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__set_value: called CC=7 SCAR=23.6
| |||||||||||||||||||||||||||||||||||||||||||
| 441 | 132 | my ( $self, @values ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | 132 | ▶ | if( @values && !( $self->readonly() && $self->self()->{__initialized} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
@values and not $self->readonly && $self->self->{"__initialized"}
$self->readonly && $self->self->{'__initialized'}
MC/DC0%0/3
@values and not $self->readonly && $self->self->{"__initialized"}
@values
$self->readonly
$self->self->{'__initialized'}
Truth table25%1/4
A and not(B && C)
A= @valuesB= $self->readonlyC= $self->self->{'__initialized'}
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | ## Handle explicit setting to undef; bypass validation, bypass everything. | ||||||||||||||||||||||||||||||||||||||||||
| 445 | 132 | $self->self()->{___fields}->{ $self->name() }->{_Set} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 446 | 132 | ▶ | if( !defined( $values[0] ) && scalar @values == 1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $values[0] and scalar @values == 1
MC/DC0%0/2
not defined $values[0] and scalar @values == 1
not defined $values[0]
scalar @values == 1
Truth table33%1/3
not(A) and B
A= not defined $values[0]B= scalar @values == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $self->self()->{___fields}->{ $self->name() }->{_Value} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||
| 450 | 132 | ▶ | $self->self()->{___fields}->{ $self->name() }->{_Set} = 0 unless($self->__validate(@values)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 451 | 132 | $self->self()->{___fields}->{ $self->name() }->{_Value} = $self->reference( $self->__validate(@values) ); | |||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||
| 453 | 132 | return; | |||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 457 | ## return empty references if our type is a *REF | ||||||||||||||||||||||||||||||||||||||||||
| 458 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 459 | sub __appropriate_undef_value | ||||||||||||||||||||||||||||||||||||||||||
| 460 | 77 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__appropriate_undef_value: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 461 | 77 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 462 | 77 | ▶ | if($self->type() =~ m/REF/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 463 | 36 | return $self->reference(); | |||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||
| 465 | elsif($self->type() eq 'SCALAR') { | ||||||||||||||||||||||||||||||||||||||||||
| 466 | 9 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||
| 468 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 469 | 32 | return( () ); | |||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||
| 474 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 475 | ## Jump through requisite hoops to obtain a value; either set or default | ||||||||||||||||||||||||||||||||||||||||||
| 476 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 477 | sub __get_value | ||||||||||||||||||||||||||||||||||||||||||
| 478 | 299 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__get_value: called CC=8 SCAR=21.8
| |||||||||||||||||||||||||||||||||||||||||||
| 479 | 299 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||
| 481 | 299 | ▶ | if($self->is_set() == 1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 482 | 217 | ▶ | if( ! defined( $self->self()->{___fields}->{ $self->name() }->{_Value} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | return $self->__appropriate_undef_value(); | |||||||||||||||||||||||||||||||||||||||||
| 484 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 485 | 217 | return $self->dereference( $self->self()->{___fields}->{ $self->name() }->{_Value} ); | |||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||
| 488 | elsif( $self->is_set() == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||
| 489 | 67 | return $self->__appropriate_undef_value(); | |||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||
| 491 | ▶ | elsif( $self->is_set() == -1 && ! $self->default_is_set() ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->is_set == -1 and not $self->default_is_set
MC/DC50%1/2
$self->is_set == -1 and not $self->default_is_set
$self->is_set == -1
not $self->default_is_set
Truth table66%2/3
A and not(B)
A= $self->is_set == -1B= not $self->default_is_set
| |||||||||||||||||||||||||||||||||||||||||||
| 492 | 10 | return $self->__appropriate_undef_value(); | |||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||
| 494 | elsif( $self->default_is_set() ) { | ||||||||||||||||||||||||||||||||||||||||||
| 495 | 5 | ▶ | return $self->__appropriate_undef_value() unless(defined( $self->default() ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 496 | 5 | return $self->default(); | |||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | return $self->reference(); | |||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||
| 502 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 503 | ## Perform the extra validation required of objects (polymorphism/inheritance) | ||||||||||||||||||||||||||||||||||||||||||
| 504 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 505 | sub __validate_obj_type | ||||||||||||||||||||||||||||||||||||||||||
| 506 | 49 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__validate_obj_type: called CC=12 SCAR=24.9
| |||||||||||||||||||||||||||||||||||||||||||
| 507 | 49 | my ( $self, $thing ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||
| 509 | 49 | ▶ | return unless( ref($thing) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 510 | 47 | ▶ | return unless( blessed($thing) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | 47 | ▶ | if( $self->object_isa() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 513 | 6 | for my $class ( $self->object_isa() ) { | |||||||||||||||||||||||||||||||||||||||||
| 514 | 6 | ▶ | return unless( $thing->isa($class) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||
| 517 | 45 | ▶ | if( $self->object_can() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 518 | 9 | for my $method ( $self->object_can() ) { | |||||||||||||||||||||||||||||||||||||||||
| 519 | 17 | ▶ | return unless( $thing->can($method) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 522 | 42 | ▶ | if( $self->implements() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 523 | 12 | for my $class ( $self->implements() ) { | |||||||||||||||||||||||||||||||||||||||||
| 524 | 12 | ▶ | return unless( $self->__validate_class_implementation( $class, $thing ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||
| 527 | 38 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 531 | ## Verify that a class implements interfaces (excluding interfaces from OOP::Perlish::Class itself) | ||||||||||||||||||||||||||||||||||||||||||
| 532 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 533 | sub __validate_class_implementation | ||||||||||||||||||||||||||||||||||||||||||
| 534 | 12 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__validate_class_implementation: called CC=7 SCAR=19.8
| |||||||||||||||||||||||||||||||||||||||||||
| 535 | 12 | my ( $self, $class, $thing ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||
| 537 | 12 | my @interfaces; | |||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | 7 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 540 | 12 | ▶ | if( scalar keys %{ '::' . $class . '::' } == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | eval "require $class"; | |||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | confess("$@") if("$@"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||||||
| 544 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||
| 546 | ### XXX: Hash slice assignment for lookup | ||||||||||||||||||||||||||||||||||||||||||
| 547 | 12 | my %oop_perlish_class_interfaces; | |||||||||||||||||||||||||||||||||||||||||
| 548 | 12 | @oop_perlish_class_interfaces{ OOP::Perlish::Class::Abstract->new()->_all_methods() } = undef; | |||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | 12 | my $class_ref = bless( {}, $class ); | |||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||
| 552 | 12 | ▶ | if( $class_ref->can('_all_methods') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 553 | 6 | @interfaces = grep { ! exists( $oop_perlish_class_interfaces{$_} ) } $class_ref->_all_methods(); | |||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||
| 555 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 556 | 6 | @interfaces = grep { ! exists( $oop_perlish_class_interfaces{$_} ) } $self->_all_methods($class); | |||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||
| 558 | 12 | ▶ | confess("No interfaces from $class") unless(@interfaces); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||
| 560 | 12 | for my $method (@interfaces) { | |||||||||||||||||||||||||||||||||||||||||
| 561 | 276 | ▶ | return unless( $thing->can($method) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||
| 563 | 8 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||
| 566 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 567 | ## Verify that the underlying type of a reference is correct for the type of this accessor | ||||||||||||||||||||||||||||||||||||||||||
| 568 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 569 | sub __validate_ref_type | ||||||||||||||||||||||||||||||||||||||||||
| 570 | 102 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__validate_ref_type: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 571 | 102 | my ( $self, $thing ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||
| 573 | 102 | ▶ | if( $self->type() eq 'OBJECT' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 574 | 49 | ▶ | return unless( $self->__validate_obj_type($thing) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||
| 576 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 577 | 53 | ▶ | return unless( ref($thing) eq $self->base_type() ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||
| 579 | 76 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||
| 582 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 583 | ## Validate that the type of the thing passed to this object is a valid type for our storage. | ||||||||||||||||||||||||||||||||||||||||||
| 584 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 585 | sub __validate_type | ||||||||||||||||||||||||||||||||||||||||||
| 586 | 274 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__validate_type: called CC=21 SCAR=30.9
| |||||||||||||||||||||||||||||||||||||||||||
| 587 | 274 | my ( $self, @values ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||
| 589 | ## Don't validate_ref_type for REF type (backwards sounding I know; but if we are a REF type, we don't care about the underlying _type_) | ||||||||||||||||||||||||||||||||||||||||||
| 590 | ## We also cannot fail an array, unfortunately, because it could be an array containing one member, a reference to something... | ||||||||||||||||||||||||||||||||||||||||||
| 591 | 274 | ▶ | if( ( ref( $values[0] ) && scalar(@values) == 1 ) && $self->type() !~ m/(?:^REF|ARRAY)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
ref $values[0] and scalar @values == 1 and not $self->type =~ /(?:^REF|ARRAY)/
ref $values[0] and scalar @values == 1
MC/DC66%2/3
ref $values[0] and scalar @values == 1 and not $self->type =~ /(?:^REF|ARRAY)/
ref $values[0]
scalar @values == 1
not $self->type =~ /(?:^REF|ARRAY)/
Truth table75%3/4
A and B and not(C)
A= ref $values[0]B= scalar @values == 1C= not $self->type =~ /(?:^REF|ARRAY)/
| |||||||||||||||||||||||||||||||||||||||||||
| 592 | 63 | ▶ | return unless( $self->__validate_ref_type( $values[0] ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||
| 595 | 257 | ▶ | if( $self->type() =~ m/REF|CODE|REGEXP|OBJECT/ && $self->type() !~ m/(?:^REF|SCALAR|ARRAY|HASH)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->type =~ /REF|CODE|REGEXP|OBJECT/ and not $self->type =~ /(?:^REF|SCALAR|ARRAY|HASH)/
MC/DC100%2/2
$self->type =~ /REF|CODE|REGEXP|OBJECT/ and not $self->type =~ /(?:^REF|SCALAR|ARRAY|HASH)/
$self->type =~ /REF|CODE|REGEXP|OBJECT/
not $self->type =~ /(?:^REF|SCALAR|ARRAY|HASH)/
Truth table100%3/3
A and not(B)
A= $self->type =~ /REF|CODE|REGEXP|OBJECT/B= not $self->type =~ /(?:^REF|SCALAR|ARRAY|HASH)/
| |||||||||||||||||||||||||||||||||||||||||||
| 596 | 39 | ▶ | return unless( $self->__validate_ref_type( $values[0] ) && scalar(@values) == 1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->__validate_ref_type($values[0]) and scalar @values == 1
MC/DC50%1/2
$self->__validate_ref_type($values[0]) and scalar @values == 1
$self->__validate_ref_type($values[0])
scalar @values == 1
Truth table66%2/3
A and B
A= $self->__validate_ref_type($values[0])B= scalar @values == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||
| 599 | 248 | for( $self->type() ) { | |||||||||||||||||||||||||||||||||||||||||
| 600 | 248 | ▶ | /^REF/ && do { return unless( scalar @values == 1 && ref( $values[0] ) ); }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
scalar @values == 1 and ref $values[0]
MC/DC50%1/2
scalar @values == 1 and ref $values[0]
scalar @values == 1
ref $values[0]
Truth table66%2/3
A and B
A= scalar @values == 1B= ref $values[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 601 | 246 | ▶ | /HASH/ && do { return unless( scalar @values % 2 == 0 || ref( $values[0] ) eq 'HASH' ); }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
scalar @values % 2 == 0 or ref $values[0] eq "HASH"
MC/DC0%0/2
scalar @values % 2 == 0 or ref $values[0] eq "HASH"
scalar @values % 2 == 0
ref $values[0] eq "HASH"
Truth table66%2/3
A or B
A= scalar @values % 2 == 0B= ref $values[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 602 | 246 | ▶ | /SCALAR/ && do { return unless( scalar @values == 1 ); }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 603 | 242 | ▶ | /GLOB/ && do { return unless( scalar @values == 1 && ref( $values[0] ) eq 'GLOB' ) }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
scalar @values == 1 and ref $values[0] eq "GLOB"
MC/DC0%0/2
scalar @values == 1 and ref $values[0] eq "GLOB"
scalar @values == 1
ref $values[0] eq "GLOB"
Truth table33%1/3
A and B
A= scalar @values == 1B= ref $values[0] eq "GLOB"
| |||||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | 242 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 610 | ## Test the validity of data using the validator of this accessor | ||||||||||||||||||||||||||||||||||||||||||
| 611 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 612 | sub __validate | ||||||||||||||||||||||||||||||||||||||||||
| 613 | 274 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__validate: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 614 | 274 | my ( $self, @values ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | 274 | ▶ | return unless(@values); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 617 | 274 | ▶ | return unless( $self->__validate_type(@values) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||
| 619 | 242 | ▶ | if( defined( $self->validator() ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 620 | 176 | return $self->validator()->( $self->self(), $self->__dereference_always(@values) ); | |||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||
| 622 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 623 | 66 | return $self->__dereference_always(@values); | |||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||
| 627 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 628 | ## This will indescriminately dereference a type to its base type; it is used because it simplifies validation | ||||||||||||||||||||||||||||||||||||||||||
| 629 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 630 | sub __dereference_always | ||||||||||||||||||||||||||||||||||||||||||
| 631 | 262 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__dereference_always: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 632 | 262 | my ( $self, @input ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||
| 634 | 262 | my @values = (); | |||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | 262 | ▶ | if( scalar @input == 1 && ref( $input[0] ) && ref( $input[0] ) eq $self->base_type() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
scalar @input == 1 and ref $input[0] and ref $input[0] eq $self->base_type
scalar @input == 1 and ref $input[0]
MC/DC100%3/3
scalar @input == 1 and ref $input[0] and ref $input[0] eq $self->base_type
scalar @input == 1
ref $input[0]
ref $input[0] eq $self->base_type
Truth table100%4/4
A and B and C
A= scalar @input == 1B= ref $input[0]C= ref $input[0] eq $self->base_type
| |||||||||||||||||||||||||||||||||||||||||||
| 637 | 45 | my $tmp_type = $self->type(); | |||||||||||||||||||||||||||||||||||||||||
| 638 | 45 | my $buf_type = $self->base_type(); | |||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||
| 640 | 45 | $self->{_Type} = $buf_type; | |||||||||||||||||||||||||||||||||||||||||
| 641 | 45 | @values = $self->dereference( $input[0] ); | |||||||||||||||||||||||||||||||||||||||||
| 642 | 45 | $self->{_Type} = $tmp_type; | |||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||
| 644 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 645 | 217 | @values = @input; | |||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||
| 647 | 262 | return @values; | |||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||
| 650 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 651 | ## Return a subroutine which will correctly validate via regexp the data of the specified type. | ||||||||||||||||||||||||||||||||||||||||||
| 652 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 653 | sub __regexp_sub_factory | ||||||||||||||||||||||||||||||||||||||||||
| 654 | 36 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__regexp_sub_factory: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||
| 655 | 36 | my ( $self, $regexp ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||
| 657 | 36 | my $possible_method; | |||||||||||||||||||||||||||||||||||||||||
| 658 | 36 | $possible_method = '__regexp_sub_impl_' . lc( $self->type() ); | |||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||
| 660 | 36 | ▶ | if( $self->can($possible_method) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 661 | 31 | return $self->$possible_method($regexp); | |||||||||||||||||||||||||||||||||||||||||
| 662 | } | ||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||
| 664 | 5 | $possible_method = '__regexp_sub_impl_' . lc( $self->base_type() ); | |||||||||||||||||||||||||||||||||||||||||
| 665 | 5 | ▶ | if( $self->can($possible_method) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 666 | 5 | return $self->$possible_method($regexp); | |||||||||||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | ▶ | return sub {return}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||
| 671 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 672 | ## "free" regexp subroutine for hashes | ||||||||||||||||||||||||||||||||||||||||||
| 673 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 674 | sub __regexp_sub_impl_hash | ||||||||||||||||||||||||||||||||||||||||||
| 675 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__regexp_sub_impl_hash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 676 | 8 | my ( $self, $regexp ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||
| 678 | 14 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 679 | 14 | my ( $this, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | 14 | my $re = $regexp; | |||||||||||||||||||||||||||||||||||||||||
| 682 | 14 | my %valid_args = (); | |||||||||||||||||||||||||||||||||||||||||
| 683 | 14 | ▶ | return unless( keys %args ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 684 | 14 | ▶ | while( my ( $key, $val ) = each %args ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 685 | 34 | ▶ | $val =~ /($re)/ && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 686 | 21 | $valid_args{$key} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||
| 689 | 14 | ▶ | return %valid_args if( scalar keys %args == scalar keys %valid_args ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 690 | 5 | return; | |||||||||||||||||||||||||||||||||||||||||
| 691 | 8 | }; | |||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||
| 694 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 695 | ## "free" regexp subroutine for arrays | ||||||||||||||||||||||||||||||||||||||||||
| 696 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 697 | sub __regexp_sub_impl_array | ||||||||||||||||||||||||||||||||||||||||||
| 698 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__regexp_sub_impl_array: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 699 | 6 | my ( $self, $regexp ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||
| 701 | 10 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||||||||||||||||
| 702 | 10 | my ( $this, @args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||
| 704 | 10 | my $re = $regexp; | |||||||||||||||||||||||||||||||||||||||||
| 705 | 10 | my @valid_args = (); | |||||||||||||||||||||||||||||||||||||||||
| 706 | 10 | ▶ | return unless(@args); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 707 | 10 | for(@args) { | |||||||||||||||||||||||||||||||||||||||||
| 708 | 30 | ▶ | return unless( defined($_) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 709 | 30 | ▶ | /($re)/x && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 710 | 17 | push @valid_args, $1; | |||||||||||||||||||||||||||||||||||||||||
| 711 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 712 | } | ||||||||||||||||||||||||||||||||||||||||||
| 713 | 10 | ▶ | return @valid_args if( scalar @args == scalar @valid_args ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 714 | 5 | return; | |||||||||||||||||||||||||||||||||||||||||
| 715 | 6 | }; | |||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||
| 718 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 719 | ## "free" regexp subroutine for scalar | ||||||||||||||||||||||||||||||||||||||||||
| 720 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 721 | sub __regexp_sub_impl_scalar | ||||||||||||||||||||||||||||||||||||||||||
| 722 | 20 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__regexp_sub_impl_scalar: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 723 | 20 | my ( $self, $regexp ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||
| 725 | 96 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||
| 726 | 96 | my ( $this, $arg ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 727 | 96 | my $re = $regexp; | |||||||||||||||||||||||||||||||||||||||||
| 728 | 96 | my $valid_arg = undef; | |||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||
| 730 | 96 | ▶ | return unless( defined($arg) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 731 | 96 | ▶ | $arg =~ m/($re)/ && do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 732 | 91 | $valid_arg = $1; | |||||||||||||||||||||||||||||||||||||||||
| 733 | 91 | ▶ | return unless( defined($valid_arg) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 734 | 91 | return $valid_arg; | |||||||||||||||||||||||||||||||||||||||||
| 735 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 736 | 5 | return; | |||||||||||||||||||||||||||||||||||||||||
| 737 | 20 | }; | |||||||||||||||||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||
| 740 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 741 | ## "free" regexp subroutine for objects (uses ref for string representation) | ||||||||||||||||||||||||||||||||||||||||||
| 742 | ############################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 743 | sub __regexp_sub_impl_object | ||||||||||||||||||||||||||||||||||||||||||
| 744 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__regexp_sub_impl_object: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 745 | 2 | my ( $self, $regexp ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||
| 747 | 4 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 748 | 4 | my ( $this, $obj ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||
| 750 | 4 | ▶ | return unless( defined $obj ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 751 | 4 | ▶ | return $obj if( ref($obj) =~ m/$regexp/ ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 752 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 753 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||
| 756 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 757 | __END__ | ||||||||||||||||||||||||||||||||||||||||||