« blib/lib/Rose/HTML/Form/Field/OnOff/Checkable.pm
↑ Summary
blib/lib/Rose/HTML/Form/Field/DateTime/Range.pm »
| 1 | package Rose::HTML::Form::Field::Compound; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 9 | ▶ | use Carp(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 9 | ▶ | use Rose::HTML::Object::Errors qw(:field); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 9 | ▶ | use Rose::HTML::Object::Messages qw(:field); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 9 | ▶ | use base qw(Rose::HTML::Form::Field Rose::HTML::Form::Field::Collection); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 9 | ▶ | use Rose::HTML::Form::Constants qw(FF_SEPARATOR); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 9 | our $VERSION = '0.611'; | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # Multiple inheritence never quite works out the way I want it to... | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 9 | Rose::HTML::Form::Field::Collection->import_methods | |||||||||||||||||||||||||||||||||||||||||
| 18 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 19 | 'hidden_field', | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 'hidden_fields', | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 'html_hidden_field', | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 'xhtml_hidden_field', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 'html_hidden_fields', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 'xhtml_hidden_fields', | ||||||||||||||||||||||||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 9 | our $Debug = undef; | |||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | sub init | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 84 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 84 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 84 | my(%args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 84 | ▶ | if(exists $args{'name'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | { | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 84 | $self->name(delete $args{'name'}); | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | else | ||||||||||||||||||||||||||||||||||||||||||
| 39 | { | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | Carp::croak __PACKAGE__, "-derived fields require a 'name' parameter in the constructor"; | |||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 84 | ▶ | $self->{'fields'} ||= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"fields"} ||= {}
MC/DC0%0/1
$self->{"fields"} ||= {}
$self->{"fields"}
Truth table50%1/2
A
A= $self->{"fields"}
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 84 | $self->build_field(); | |||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 84 | local $self->{'in_init'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 84 | $self->SUPER::init(@_); | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | sub is_flat_group { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_flat_group: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | sub children | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
children: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 4 | ▶ | Carp::croak "Cannot set children() for a pseudo-group ($_[0])" if(@_ > 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 4 | ▶ | return wantarray ? () : []; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 4 | ▶ | sub value { shift->input_value(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | ▶ | sub build_field { } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_field: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | sub init_fields | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_fields: called CC=6 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | my($self, %fields) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | foreach my $field_name (keys %fields) | |||||||||||||||||||||||||||||||||||||||||
| 68 | { | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 3 | ▶ | my $field = $self->field($field_name) || | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->field($field_name) || Carp::croak("No such field: $field_name")
MC/DC0%0/1
$self->field($field_name) || Carp::croak("No such field: $field_name")
$self->field($field_name)
Truth table50%1/2
A
A= $self->field($field_name)
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | Carp::croak "No such field: $field_name"; | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 3 | ▶ | if($field->isa('Rose::HTML::Form::Field::Group')) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | { | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | $Debug && warn "$self $field_name(s) = $fields{$field_name}\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | $field->_set_input_value($fields{$field_name}); | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | else | ||||||||||||||||||||||||||||||||||||||||||
| 78 | { | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 3 | ▶ | $Debug && warn "$self $field_name = $fields{$field_name}\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 3 | $field->_set_input_value($fields{$field_name}); | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 2 | ▶ | sub html_field { join('', map { $_->html_field } shift->fields) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
html_field: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 2 | ▶ | sub xhtml_field { join('', map { $_->xhtml_field } shift->fields) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xhtml_field: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | sub resync_name | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 291 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resync_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 291 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 291 | $self->SUPER::resync_name(); | |||||||||||||||||||||||||||||||||||||||||
| 93 | 291 | $self->resync_field_names; | |||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | sub name | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 1189 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 1189 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 1189 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 171 | $self->local_name(shift); | |||||||||||||||||||||||||||||||||||||||||
| 103 | 171 | $self->resync_field_names; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 171 | return $self->fq_name; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 1018 | return $self->fq_name; | |||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | sub clear | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 275 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 275 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 275 | $self->_set_input_value(undef); | |||||||||||||||||||||||||||||||||||||||||
| 115 | 275 | $self->clear_fields(); | |||||||||||||||||||||||||||||||||||||||||
| 116 | 275 | $self->error(undef); | |||||||||||||||||||||||||||||||||||||||||
| 117 | 275 | $self->SUPER::clear(); | |||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | sub reset | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 12 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 12 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 12 | $self->reset_fields(); | |||||||||||||||||||||||||||||||||||||||||
| 125 | 12 | $self->SUPER::reset(); | |||||||||||||||||||||||||||||||||||||||||
| 126 | 12 | $self->is_cleared(0); | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 4 | ▶ | sub decompose_value { {} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decompose_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | # Evil hash grab for efficiency. May change to shift->input_value() | ||||||||||||||||||||||||||||||||||||||||||
| 132 | # if it becomes a problem someday... | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 3 | ▶ | sub coalesce_value { shift->{'input_value'} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
coalesce_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | sub distribute_value | ||||||||||||||||||||||||||||||||||||||||||
| 136 | 711 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
distribute_value: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 711 | my($self, $value, $type) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | #$type ||= 'input_value'; | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 711 | ▶ | my $method = ((!$type || $type eq 'input_value')) ? '_set_input_value' : $type; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $type or $type eq "input_value"
MC/DC50%1/2
not $type or $type eq "input_value"
not $type
$type eq "input_value"
Truth table66%2/3
not(A) or B
A= not $typeB= $type eq "input_value"
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 711 | ▶ | if(my $split = $self->decompose_value($value)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | { | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 83 | ▶ | while(my($name, $val) = each(%$split)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||||||||||||||||
| 147 | #$self->field($name)->$type($val); | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 238 | $self->field($name)->$method($val); | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | sub default_value | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 1265 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_value: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | 1265 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 1265 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | { | ||||||||||||||||||||||||||||||||||||||||||
| 159 | 7 | my $value = $self->SUPER::default_value(@_); | |||||||||||||||||||||||||||||||||||||||||
| 160 | 7 | $self->distribute_value($value, 'default_value'); | |||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 1265 | return $self->SUPER::default_value; | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 9 | *auto_invalidate_parents = \&Rose::HTML::Form::Field::auto_invalidate_parents; | |||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | sub invalidate_value | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 89 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
invalidate_value: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 89 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 89 | $self->SUPER::invalidate_value(); | |||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 89 | ▶ | if($self->_is_full) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | { | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 19 | $self->_set_input_value($self->coalesce_value); | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | else | ||||||||||||||||||||||||||||||||||||||||||
| 179 | { | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 70 | ▶ | if($self->is_empty) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | { | ||||||||||||||||||||||||||||||||||||||||||
| 182 | 18 | $self->has_partial_value(0); | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | else | ||||||||||||||||||||||||||||||||||||||||||
| 185 | { | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 52 | $self->has_partial_value(1); | |||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 70 | $self->_set_input_value(undef); | |||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 89 | my $parent = $self->parent_field; | |||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 89 | ▶ | if($parent) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | { | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 27 | $parent->invalidate_value(); | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 89 | return; | |||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | sub subfield_input_value | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subfield_input_value: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 4 | my($self, $name) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 205 | 4 | ▶ | my $field = $self->field($name) or Carp::croak "No such subfield '$name'"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 4 | $field->_set_input_value(@_); | |||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | sub input_value | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 1152 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
input_value: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 1152 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 1152 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | { | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 704 | my $value = $self->SUPER::input_value(@_); | |||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 704 | ▶ | if((my $parent = $self->parent_field) && $self->auto_invalidate_parent) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
my $parent = $self->parent_field and $self->auto_invalidate_parent
MC/DC0%0/2
my $parent = $self->parent_field and $self->auto_invalidate_parent
my $parent = $self->parent_field
$self->auto_invalidate_parent
Truth table66%2/3
A and B
A= my $parent = $self->parent_fieldB= $self->auto_invalidate_parent
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | { | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $parent->invalidate_value; | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 704 | $self->distribute_value($value, 'input_value'); | |||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 1152 | my $ret = $self->SUPER::input_value; | |||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 1152 | ▶ | if(defined $ret || $self->is_empty || $self->has_partial_value) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
defined $ret or $self->is_empty or $self->has_partial_value
defined $ret or $self->is_empty
MC/DC100%3/3
defined $ret or $self->is_empty or $self->has_partial_value
defined $ret
$self->is_empty
$self->has_partial_value
Truth table100%4/4
A or B or C
A= defined $retB= $self->is_emptyC= $self->has_partial_value
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | { | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 1122 | return $ret; | |||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 30 | return $self->coalesce_value; | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | sub is_empty | ||||||||||||||||||||||||||||||||||||||||||
| 236 | 1397 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_empty: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 1397 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 1397 | foreach my $field ($self->fields) | |||||||||||||||||||||||||||||||||||||||||
| 240 | { | ||||||||||||||||||||||||||||||||||||||||||
| 241 | 4165 | ▶ | return 0 unless($field->is_empty); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 1223 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | sub is_full | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 72 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_full: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | 72 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | 72 | foreach my $field ($self->fields) | |||||||||||||||||||||||||||||||||||||||||
| 252 | { | ||||||||||||||||||||||||||||||||||||||||||
| 253 | 148 | ▶ | return 0 if($field->is_empty); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 37 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | sub validate | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 23 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | 23 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | 23 | ▶ | if($self->required) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | { | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 5 | my @missing; | |||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | 5 | foreach my $field ($self->fields) | |||||||||||||||||||||||||||||||||||||||||
| 268 | { | ||||||||||||||||||||||||||||||||||||||||||
| 269 | 9 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 15 | ▶ | unless(length $field->input_value_filtered) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | { | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 11 | ▶ | push(@missing, sub { $field->error_label || $field->local_name }); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 5 | ▶ | if(@missing) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | { | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 5 | ▶ | if(@missing == $self->num_fields) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | { | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 2 | return $self->SUPER::validate(@_); | |||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | 3 | $self->error_id(FIELD_REQUIRED, { missing => \@missing }); | |||||||||||||||||||||||||||||||||||||||||
| 284 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 18 | return $self->SUPER::validate(@_); | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | sub disabled | ||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disabled: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | foreach my $field ($self->fields) | |||||||||||||||||||||||||||||||||||||||||
| 296 | { | ||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | $field->disabled(@_) if($field->can('disabled')); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | sub message_for_error_id | ||||||||||||||||||||||||||||||||||||||||||
| 302 | 11 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
message_for_error_id: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 11 | my($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 11 | my $error_id = $args{'error_id'}; | |||||||||||||||||||||||||||||||||||||||||
| 306 | 11 | my $msg_class = $args{'msg_class'}; | |||||||||||||||||||||||||||||||||||||||||
| 307 | 11 | ▶ | my $args = $args{'args'} || []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'args'} || []
MC/DC100%1/1
$args{'args'} || []
$args{'args'}
Truth table100%2/2
A
A= $args{'args'}
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 9 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 11 | ▶ | if($error_id == FIELD_REQUIRED) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | { | ||||||||||||||||||||||||||||||||||||||||||
| 312 | 5 | my $msg = $msg_class->new(args => $args); | |||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | 5 | ▶ | if(ref $args eq 'HASH' && keys %$args) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $args eq "HASH" and keys %$args
MC/DC50%1/2
ref $args eq "HASH" and keys %$args
ref $args eq "HASH"
keys %$args
Truth table66%2/3
A and B
A= ref $args eq "HASH"B= keys %$args
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | { | ||||||||||||||||||||||||||||||||||||||||||
| 316 | 4 | ▶ | if($args->{'missing'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | { | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 3 | ▶ | if(@{$args->{'missing'}} > 1) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | { | ||||||||||||||||||||||||||||||||||||||||||
| 320 | 2 | $msg->id(FIELD_REQUIRED_SUBFIELDS); | |||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||
| 322 | else | ||||||||||||||||||||||||||||||||||||||||||
| 323 | { | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 1 | $msg->id(FIELD_REQUIRED_SUBFIELD); | |||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||
| 327 | else | ||||||||||||||||||||||||||||||||||||||||||
| 328 | { | ||||||||||||||||||||||||||||||||||||||||||
| 329 | 1 | $msg->id(FIELD_REQUIRED_LABELLED); | |||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 332 | else | ||||||||||||||||||||||||||||||||||||||||||
| 333 | { | ||||||||||||||||||||||||||||||||||||||||||
| 334 | 1 | $msg->id(FIELD_REQUIRED_GENERIC); | |||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 5 | return $msg; | |||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 6 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | 9 | ▶ | if(__PACKAGE__->localizer->auto_load_messages) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | { | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | __PACKAGE__->localizer->load_all_messages; | |||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 9 | ▶ | use utf8; # The __DATA__ section contains UTF-8 text | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | __DATA__ | ||||||||||||||||||||||||||||||||||||||||||