FormHandler/Widget/Field/Role/SelectedOption.pm untested

filter: Statementstmt 0.0% 0 / 14 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 24 CC 4 SCAR 26.4
CC
4
Cov
0%
check_selected_option
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 14.0
1 package HTML::FormHandler::Widget::Field::Role::SelectedOption;
2 # ABSTRACT: allow setting options from options keys
3 $HTML::FormHandler::Widget::Field::Role::SelectedOption::VERSION = '0.410002';
4 use Moose::Role;
5 use namespace::autoclean;
6  
7 sub check_selected_option {
8 my ( $self, $option, $fif ) = @_;
9 my $selected_key = defined($option->{'selected'}) ?
10 $option->{'selected'}
11 : $option->{'checked'};
12 if ( defined $selected_key ) {
13 return $selected_key;
14 } elsif ( defined $fif ) {
15 return $fif eq $option->{'value'};
16 } else {
17 return;
18 }
19 }
20  
21 1;
22  
23 __END__