FormHandler/Field/Checkbox.pm

filter: Statementstmt 100% 19 / 19 Branchbran 100% 2 / 2 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 100% 30 / 30 CC 3 SCAR 7.9
CC
3
Cov
100%
validate
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« FormHandler/Field/DateTime.pm ↑ Summary FormHandler/Types.pm »
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
BranchTrueFalseTotal
if $self->required and not $self->value 2 48 50
Condition100%3/3
$self->required and not $self->value
!ll&&!rl&&r
4082
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
ABresult
0X0
100
111
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__
« FormHandler/Field/DateTime.pm ↑ Summary FormHandler/Types.pm »