| 1 | package HTML::FormHandler::Field::Checkbox; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: a checkbox field type | ||||||||||||||||||||||||||||
| 3 | 25 | $HTML::FormHandler::Field::Checkbox::VERSION = '0.410002'; | |||||||||||||||||||||||||||
| 4 | 25 | ▶ | use HTML::FormHandler::Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 25 | extends 'HTML::FormHandler::Field'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 25 | has '+widget' => ( default => 'Checkbox' ); | |||||||||||||||||||||||||||
| 9 | 25 | has 'checkbox_value' => ( is => 'rw', default => 1 ); | |||||||||||||||||||||||||||
| 10 | 25 | has '+input_without_param' => ( default => 0 ); | |||||||||||||||||||||||||||
| 11 | 25 | has '+type_attr' => ( default => 'checkbox' ); | |||||||||||||||||||||||||||
| 12 | 25 | has 'option_label' => ( is => 'rw' ); | |||||||||||||||||||||||||||
| 13 | 25 | has 'option_wrapper' => ( is => 'rw' ); | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 50 | ▶ | sub validate { | ||||||||||||||||||||||||||
|
Subroutine
validate: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 16 | 50 | my $self = shift; | |||||||||||||||||||||||||||
| 17 | 50 | ▶ | $self->add_error($self->get_message('required'), $self->loc_label) if( $self->required && !$self->value ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->required and not $self->value
MC/DC100%2/2
$self->required and not $self->value
$self->required
not $self->value
Truth table100%3/3
A and not(B)
A= $self->requiredB= not $self->value
| |||||||||||||||||||||||||||||
| 18 | 50 | return; | |||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 25 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 22 | 25 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 25 | 1; | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | __END__ | ||||||||||||||||||||||||||||