| 1 | package Alzabo::Create::Column; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 9 | ▶ | use Alzabo::Create; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 9 | ▶ | use Alzabo::Exceptions ( abbr => 'params_exception' ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 9 | ▶ | use Params::Validate qw( :all ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | Params::Validate::validation_options | ||||||||||||||||||||||||||||
| 11 | 0 | ▶ | ( on_fail => sub { params_exception join '', @_ } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 9 | ▶ | use base qw(Alzabo::Column); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 9 | $VERSION = 2.0; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 9 | 1; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | sub new | ||||||||||||||||||||||||||||
| 20 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 21 | 0 | my $proto = shift; | |||||||||||||||||||||||||||
| 22 | 0 | ▶ | my $class = ref $proto || $proto; | ||||||||||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 0 | my $self = bless {}, $class; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | $self->_init(@_); | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | return $self; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | sub _init | ||||||||||||||||||||||||||||
| 32 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_init: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 33 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 0 | my %p = | |||||||||||||||||||||||||||
| 36 | validate( @_, { table => { isa => 'Alzabo::Table' }, | ||||||||||||||||||||||||||||
| 37 | name => { type => SCALAR }, | ||||||||||||||||||||||||||||
| 38 | null => { optional => 1 }, | ||||||||||||||||||||||||||||
| 39 | nullable => { optional => 1 }, | ||||||||||||||||||||||||||||
| 40 | type => { type => SCALAR, | ||||||||||||||||||||||||||||
| 41 | optional => 1 }, | ||||||||||||||||||||||||||||
| 42 | attributes => { type => ARRAYREF, | ||||||||||||||||||||||||||||
| 43 | default => [] }, | ||||||||||||||||||||||||||||
| 44 | default => { type => BOOLEAN, | ||||||||||||||||||||||||||||
| 45 | optional => 1 }, | ||||||||||||||||||||||||||||
| 46 | default_is_raw => { type => BOOLEAN, | ||||||||||||||||||||||||||||
| 47 | default => 0 }, | ||||||||||||||||||||||||||||
| 48 | sequenced => { optional => 1 }, | ||||||||||||||||||||||||||||
| 49 | length => { type => BOOLEAN, | ||||||||||||||||||||||||||||
| 50 | optional => 1 }, | ||||||||||||||||||||||||||||
| 51 | precision => { type => BOOLEAN, | ||||||||||||||||||||||||||||
| 52 | optional => 1 }, | ||||||||||||||||||||||||||||
| 53 | definition => { isa => 'Alzabo::Create::ColumnDefinition', | ||||||||||||||||||||||||||||
| 54 | optional => 1 }, | ||||||||||||||||||||||||||||
| 55 | comment => { type => BOOLEAN, | ||||||||||||||||||||||||||||
| 56 | default => '' }, | ||||||||||||||||||||||||||||
| 57 | } ); | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 0 | $self->set_table( $p{table} ); | |||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | $self->set_name( $p{name} ); | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | $self->{nullable} = $p{nullable} || $p{null} || 0; | ||||||||||||||||||||||||||
|
Condition0%0/5
$p{'nullable'} || $p{'null'} || 0
$p{"nullable"} or $p{"null"}
MC/DC0%0/2
$p{'nullable'} || $p{'null'} || 0
$p{"nullable"}
$p{"null"}
Truth table0%0/3
A or B
A= $p{"nullable"}B= $p{"null"}
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if ($p{definition}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | { | ||||||||||||||||||||||||||||
| 67 | 0 | $self->set_definition( $p{definition} ); | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | else | ||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||
| 71 | $self->set_definition | ||||||||||||||||||||||||||||
| 72 | ( Alzabo::Create::ColumnDefinition->new | ||||||||||||||||||||||||||||
| 73 | ( owner => $self, | ||||||||||||||||||||||||||||
| 74 | type => $p{type}, | ||||||||||||||||||||||||||||
| 75 | ) | ||||||||||||||||||||||||||||
| 76 | 0 | ); | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 0 | my %attr; | |||||||||||||||||||||||||||
| 80 | 0 | tie %{ $self->{attributes} }, 'Tie::IxHash'; | |||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | $self->set_attributes( @{ $p{attributes} } ); | |||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | ▶ | $self->set_sequenced( $p{sequenced} || 0 ); | ||||||||||||||||||||||||||
|
Condition0%0/2
$p{'sequenced'} || 0
MC/DC0%0/1
$p{'sequenced'} || 0
$p{'sequenced'}
Truth table0%0/2
A
A= $p{'sequenced'}
| |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | $self->set_default( $p{default} ) | ||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if exists $p{default}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | 0 | $self->set_default_is_raw( $p{default_is_raw} ); | |||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | # We always set length, since not giving a length at all may be an | ||||||||||||||||||||||||||||
| 91 | # error for some column types, unless we got a definition object, | ||||||||||||||||||||||||||||
| 92 | # in which case it should contain the length & precision. | ||||||||||||||||||||||||||||
| 93 | $self->set_length( length => $p{length}, precision => $p{precision} ) | ||||||||||||||||||||||||||||
| 94 | 0 | ▶ | unless $p{definition}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | $self->set_comment( $p{comment} ); | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | sub set_table | ||||||||||||||||||||||||||||
| 100 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_table: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 101 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 0 | validate_pos( @_, { isa => 'Alzabo::Create::Table' } ); | |||||||||||||||||||||||||||
| 104 | 0 | $self->{table} = shift; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | sub set_name | ||||||||||||||||||||||||||||
| 108 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_name: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 109 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | validate_pos( @_, { type => SCALAR } ); | |||||||||||||||||||||||||||
| 112 | 0 | my $name = shift; | |||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 0 | ▶ | params_exception "Column $name already exists in table" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | if $self->table->has_column($name); | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 0 | my $old_name = $self->{name}; | |||||||||||||||||||||||||||
| 118 | 0 | $self->{name} = $name; | |||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | eval | ||||||||||||||||||||||||||||
| 121 | 0 | { | |||||||||||||||||||||||||||
| 122 | 0 | $self->table->schema->rules->validate_column_name($self); | |||||||||||||||||||||||||||
| 123 | }; | ||||||||||||||||||||||||||||
| 124 | 0 | ▶ | if ($@) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | { | ||||||||||||||||||||||||||||
| 126 | 0 | $self->{name} = $old_name; | |||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 0 | rethrow_exception($@); | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | ▶ | $self->table->register_column_name_change( column => $self, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 132 | old_name => $old_name ) | ||||||||||||||||||||||||||||
| 133 | if $old_name; | ||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | sub set_nullable | ||||||||||||||||||||||||||||
| 137 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_nullable: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 138 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 0 | validate_pos( @_, { type => SCALAR } ); | |||||||||||||||||||||||||||
| 141 | 0 | my $n = shift; | |||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | params_exception "Invalid value for nullable attribute: $n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$n eq 1 or $n eq 0
MC/DC0%0/2
$n eq 1 or $n eq 0
$n eq 1
$n eq 0
Truth table0%0/3
A or B
A= $n eq 1B= $n eq 0
| |||||||||||||||||||||||||||||
| 144 | unless $n eq '1' || $n eq '0'; | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | 0 | ▶ | params_exception "Primary key column cannot be nullable" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$n eq 1 and $self->is_primary_key
MC/DC0%0/2
$n eq 1 and $self->is_primary_key
$n eq 1
$self->is_primary_key
Truth table0%0/3
A and B
A= $n eq 1B= $self->is_primary_key
| |||||||||||||||||||||||||||||
| 147 | if $n eq '1' && $self->is_primary_key; | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 0 | $self->{nullable} = $n; | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | sub set_default | ||||||||||||||||||||||||||||
| 153 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_default: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 154 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 0 | validate_pos( @_, { type => BOOLEAN } ); | |||||||||||||||||||||||||||
| 157 | 0 | $self->{default} = shift; | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | sub set_default_is_raw | ||||||||||||||||||||||||||||
| 161 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_default_is_raw: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 162 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 0 | validate_pos( @_, { type => BOOLEAN } ); | |||||||||||||||||||||||||||
| 165 | 0 | $self->{default_is_raw} = shift; | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | sub set_length | ||||||||||||||||||||||||||||
| 169 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_length: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 170 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 0 | $self->{definition}->set_length(@_); | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | sub set_attributes | ||||||||||||||||||||||||||||
| 176 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_attributes: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 177 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 0 | validate_pos( @_, ( { type => SCALAR } ) x @_ ); | |||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | 0 | %{ $self->{attributes} } = (); | |||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 0 | foreach (@_) | |||||||||||||||||||||||||||
| 184 | { | ||||||||||||||||||||||||||||
| 185 | 0 | $self->add_attribute($_); | |||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | sub add_attribute | ||||||||||||||||||||||||||||
| 190 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
add_attribute: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 191 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 0 | validate_pos( @_, { type => SCALAR } ); | |||||||||||||||||||||||||||
| 194 | 0 | my $attr = shift; | |||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 0 | $attr =~ s/^\s+//; | |||||||||||||||||||||||||||
| 197 | 0 | $attr =~ s/\s+$//; | |||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 0 | $self->table->schema->rules->validate_column_attribute( column => $self, | |||||||||||||||||||||||||||
| 200 | attribute => $attr ); | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 0 | $self->{attributes}{$attr} = 1; | |||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | sub delete_attribute | ||||||||||||||||||||||||||||
| 206 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
delete_attribute: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 207 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 0 | validate_pos( @_, { type => SCALAR } ); | |||||||||||||||||||||||||||
| 210 | 0 | my $attr = shift; | |||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | params_exception "Column " . $self->name . " doesn't have attribute $attr" | ||||||||||||||||||||||||||||
| 213 | 0 | ▶ | unless exists $self->{attributes}{$attr}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | delete $self->{attributes}{$attr}; | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | sub alter | ||||||||||||||||||||||||||||
| 219 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
alter: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 220 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 221 | 0 | $self->{definition}->alter(@_); | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | # this will force them to go through the rules code again. | ||||||||||||||||||||||||||||
| 224 | # Attributes that don't work with the new type are silently | ||||||||||||||||||||||||||||
| 225 | # discarded. | ||||||||||||||||||||||||||||
| 226 | 0 | foreach ( $self->attributes ) | |||||||||||||||||||||||||||
| 227 | { | ||||||||||||||||||||||||||||
| 228 | 0 | $self->delete_attribute($_); | |||||||||||||||||||||||||||
| 229 | 0 | eval { $self->add_attribute($_) }; | |||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | sub set_type | ||||||||||||||||||||||||||||
| 234 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_type: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 235 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 0 | validate_pos( @_, { type => SCALAR } ); | |||||||||||||||||||||||||||
| 238 | 0 | my $t = shift; | |||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | 0 | $self->{definition}->set_type($t); | |||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | # this will force them to go through the rules code again. | ||||||||||||||||||||||||||||
| 243 | # Attributes that don't work with the new type are silently | ||||||||||||||||||||||||||||
| 244 | # discarded. | ||||||||||||||||||||||||||||
| 245 | 0 | foreach ( $self->attributes ) | |||||||||||||||||||||||||||
| 246 | { | ||||||||||||||||||||||||||||
| 247 | 0 | $self->delete_attribute($_); | |||||||||||||||||||||||||||
| 248 | 0 | eval { $self->add_attribute($_) }; | |||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 0 | ▶ | if ( $self->length ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 252 | { | ||||||||||||||||||||||||||||
| 253 | 0 | eval { $self->set_length( length => $self->length, | |||||||||||||||||||||||||||
| 254 | precision => $self->precision ) }; | ||||||||||||||||||||||||||||
| 255 | 0 | ▶ | if ($@) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 256 | { | ||||||||||||||||||||||||||||
| 257 | 0 | eval { $self->set_length( length => $self->length, precision => undef ) }; | |||||||||||||||||||||||||||
| 258 | 0 | ▶ | if ($@) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 259 | { | ||||||||||||||||||||||||||||
| 260 | 0 | $self->set_length( length => undef, | |||||||||||||||||||||||||||
| 261 | precision => undef ); | ||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | sub set_sequenced | ||||||||||||||||||||||||||||
| 268 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_sequenced: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 269 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | 0 | validate_pos( @_, { type => SCALAR } ); | |||||||||||||||||||||||||||
| 272 | 0 | my $s = shift; | |||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | 0 | ▶ | params_exception "Invalid value for sequenced attribute: $s" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$s eq 1 or $s eq 0
MC/DC0%0/2
$s eq 1 or $s eq 0
$s eq 1
$s eq 0
Truth table0%0/3
A or B
A= $s eq 1B= $s eq 0
| |||||||||||||||||||||||||||||
| 275 | unless $s eq '1' || $s eq '0'; | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | 0 | ▶ | $self->table->schema->rules->validate_sequenced_attribute($self) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 278 | if $s eq '1'; | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | 0 | $self->{sequenced} = $s; | |||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | sub set_definition | ||||||||||||||||||||||||||||
| 284 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_definition: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 285 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | 0 | validate_pos( @_, { isa => 'Alzabo::Create::ColumnDefinition' } ); | |||||||||||||||||||||||||||
| 288 | 0 | my $d = shift; | |||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | 0 | $self->{definition} = $d; | |||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 0 | ▶ | sub set_comment { $_[0]->{comment} = defined $_[1] ? $_[1] : '' } | ||||||||||||||||||||||||||
|
Subroutine
set_comment: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | sub save_current_name | ||||||||||||||||||||||||||||
| 296 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
save_current_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 297 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | 0 | $self->{last_instantiated_name} = $self->name; | |||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | 0 | ▶ | sub former_name { $_[0]->{last_instantiated_name} } | ||||||||||||||||||||||||||
|
Subroutine
former_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | __END__ | ||||||||||||||||||||||||||||