« blib/lib/Rose/HTML/Form/Field/RadioButtonGroup.pm
↑ Summary
blib/lib/Rose/HTML/Form/Field/Integer.pm »
| 1 | package Rose::HTML::Form::Field::OnOff::Selectable; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 12 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | |||||||||||||||
| 5 | 12 | ▶ | use base 'Rose::HTML::Form::Field::OnOff'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | |||||||||||||||
| 7 | 12 | our $VERSION = '0.606'; | |||||||||||||
| 8 | |||||||||||||||
| 9 | 12 | __PACKAGE__->required_html_attr_value | |||||||||||||
| 10 | ( | ||||||||||||||
| 11 | value => '', | ||||||||||||||
| 12 | ); | ||||||||||||||
| 13 | |||||||||||||||
| 14 | sub selected | ||||||||||||||
| 15 | 4270 | ▶ | { | ||||||||||||
|
Subroutine
selected: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||
| 16 | 4270 | my($self) = shift; | |||||||||||||
| 17 | |||||||||||||||
| 18 | 4270 | ▶ | if(@_) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 19 | { | ||||||||||||||
| 20 | 1218 | $self->is_cleared(0); | |||||||||||||
| 21 | 1218 | ▶ | return $self->{'selected'} = | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 22 | $self->html_attr(selected => $_[0] ? 1 : (defined $_[0] ? 0 : undef)); | ||||||||||||||
| 23 | } | ||||||||||||||
| 24 | |||||||||||||||
| 25 | 3052 | ▶ | return 0 if($self->is_cleared); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 26 | |||||||||||||||
| 27 | 1619 | ▶ | return defined $self->{'selected'} ? $self->{'selected'} : $self->default_value; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 28 | } | ||||||||||||||
| 29 | |||||||||||||||
| 30 | 12 | *input_value = \&selected; | |||||||||||||
| 31 | |||||||||||||||
| 32 | 2461 | ▶ | sub is_selected { shift->selected ? 1 : 0 } | ||||||||||||
|
Subroutine
is_selected: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||
| 33 | |||||||||||||||
| 34 | 2460 | ▶ | sub is_on { shift->is_selected } | ||||||||||||
|
Subroutine
is_on: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||
| 35 | |||||||||||||||
| 36 | sub clear | ||||||||||||||
| 37 | 859 | ▶ | { | ||||||||||||
|
Subroutine
clear: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 38 | 859 | my($self) = shift; | |||||||||||||
| 39 | |||||||||||||||
| 40 | 859 | $self->selected(0); | |||||||||||||
| 41 | 859 | $self->error(undef); | |||||||||||||
| 42 | 859 | $self->is_cleared(1); | |||||||||||||
| 43 | } | ||||||||||||||
| 44 | |||||||||||||||
| 45 | sub reset | ||||||||||||||
| 46 | 47 | ▶ | { | ||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 47 | 47 | my($self) = shift; | |||||||||||||
| 48 | |||||||||||||||
| 49 | 47 | $self->selected(undef); | |||||||||||||
| 50 | 47 | $self->error(undef); | |||||||||||||
| 51 | 47 | $self->is_cleared(0); | |||||||||||||
| 52 | 47 | return 1; | |||||||||||||
| 53 | } | ||||||||||||||
| 54 | |||||||||||||||
| 55 | sub hidden | ||||||||||||||
| 56 | 614 | ▶ | { | ||||||||||||
|
Subroutine
hidden: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||
| 57 | 614 | my($self) = shift; | |||||||||||||
| 58 | |||||||||||||||
| 59 | 614 | ▶ | if(@_) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 60 | { | ||||||||||||||
| 61 | 31 | ▶ | if($self->{'_hidden'} = shift(@_) ? 1 : 0) | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 62 | { | ||||||||||||||
| 63 | 15 | $self->selected(undef); | |||||||||||||
| 64 | } | ||||||||||||||
| 65 | } | ||||||||||||||
| 66 | |||||||||||||||
| 67 | 614 | return $self->{'_hidden'}; | |||||||||||||
| 68 | } | ||||||||||||||
| 69 | |||||||||||||||
| 70 | 12 | 1; | |||||||||||||