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.410000';
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__
24  
25 =pod
26  
27 =encoding UTF-8
28  
29 =head1 NAME
30  
31 HTML::FormHandler::Widget::Field::Role::SelectedOption - allow setting options from options keys
32  
33 =head1 VERSION
34  
35 version 0.410000
36  
37 =head1 AUTHOR
38  
39 FormHandler Contributors - see HTML::FormHandler
40  
41 =head1 COPYRIGHT AND LICENSE
42  
43 This software is copyright (c) 2017 by Gerda Shank.
44  
45 This is free software; you can redistribute it and/or modify it under
46 the same terms as the Perl 5 programming language system itself.
47  
48 =cut