| 1 | package Rose::HTML::Form::Field::OnOff::Checkable; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 9 | ▶ | use base 'Rose::HTML::Form::Field::OnOff'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 9 | our $VERSION = '0.606'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 9 | __PACKAGE__->add_required_html_attrs( | |||||||||||||||||||||||||||
| 10 | { | ||||||||||||||||||||||||||||
| 11 | value => 'on', | ||||||||||||||||||||||||||||
| 12 | }); | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | sub checked | ||||||||||||||||||||||||||||
| 15 | 1204 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
checked: called CC=8 SCAR=21.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 16 | 1204 | my($self) = shift; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1204 | ▶ | if(@_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 19 | { | ||||||||||||||||||||||||||||
| 20 | 555 | $self->is_cleared(0); | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 555 | ▶ | $self->{'checked'} = | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 23 | $self->html_attr(checked => $_[0] ? 1 : (defined $_[0] ? 0 : undef)); | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 555 | ▶ | if((my $parent = $self->parent_field) && $self->auto_invalidate_parent) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/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 table33%1/3
A and B
A= my $parent = $self->parent_fieldB= $self->auto_invalidate_parent
| |||||||||||||||||||||||||||||
| 26 | { | ||||||||||||||||||||||||||||
| 27 | 0 | $parent->invalidate_value; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 555 | return $self->{'checked'}; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 649 | ▶ | return 0 if($self->is_cleared); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 556 | ▶ | return defined $self->{'checked'} ? $self->{'checked'} : $self->default_value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 9 | *input_value = \&checked; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 259 | ▶ | sub is_checked { shift->checked ? 1 : 0 } | ||||||||||||||||||||||||||
|
Subroutine
is_checked: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 259 | ▶ | sub is_on { shift->is_checked } | ||||||||||||||||||||||||||
|
Subroutine
is_on: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 143 | ▶ | sub value { shift->html_attr('value', @_) } | ||||||||||||||||||||||||||
|
Subroutine
value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | sub clear | ||||||||||||||||||||||||||||
| 46 | 380 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
clear: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | 380 | my($self) = shift; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 380 | $self->checked(0); | |||||||||||||||||||||||||||
| 50 | 380 | $self->error(undef); | |||||||||||||||||||||||||||
| 51 | 380 | $self->is_cleared(1); | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | sub reset | ||||||||||||||||||||||||||||
| 55 | 42 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 56 | 42 | my($self) = shift; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 42 | $self->checked(undef); | |||||||||||||||||||||||||||
| 59 | 42 | $self->error(undef); | |||||||||||||||||||||||||||
| 60 | 42 | $self->is_cleared(0); | |||||||||||||||||||||||||||
| 61 | 42 | return 1; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | sub hidden | ||||||||||||||||||||||||||||
| 65 | 387 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
hidden: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 66 | 387 | my($self) = shift; | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 387 | ▶ | if(@_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | { | ||||||||||||||||||||||||||||
| 70 | 32 | ▶ | if($self->{'_hidden'} = shift(@_) ? 1 : 0) | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 71 | { | ||||||||||||||||||||||||||||
| 72 | 16 | $self->checked(undef); | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 387 | return $self->{'_hidden'}; | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 9 | 1; | |||||||||||||||||||||||||||