| 1 | package HTML::FormHandler::Field::SelectCSV; | ||||||||||
| 2 | # ABSTRACT: Multiple select field from CSV value | ||||||||||
| 3 | 1 | $HTML::FormHandler::Field::SelectCSV::VERSION = '0.410002'; | |||||||||
| 4 | 1 | ▶ | use HTML::FormHandler::Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | extends 'HTML::FormHandler::Field::Select'; | |||||||||
| 6 | |||||||||||
| 7 | |||||||||||
| 8 | 2 | ▶ | has '+inflate_default_method' => ( default => sub { \&selectcsv_inflate_default } ); | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 2 | ▶ | has '+deflate_value_method' => ( default => sub { \&selectcsv_deflate_value } ); | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | has '+multiple' => ( default => 1 ); | |||||||||
| 11 | 1 | ▶ | sub build_value_when_empty { undef } | ||||||||
|
Subroutine
build_value_when_empty: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 12 | |||||||||||
| 13 | 3 | ▶ | sub selectcsv_inflate_default { | ||||||||
|
Subroutine
selectcsv_inflate_default: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||
| 14 | 3 | my ( $self, $value ) = @_; | |||||||||
| 15 | 3 | ▶ | if( defined $value ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 3 | my @values = split (/,/, $value); | |||||||||
| 17 | 3 | return @values; | |||||||||
| 18 | } | ||||||||||
| 19 | 0 | return; | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 1 | ▶ | sub selectcsv_deflate_value { | ||||||||
|
Subroutine
selectcsv_deflate_value: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||
| 23 | 1 | my ( $self, $value ) = @_; | |||||||||
| 24 | 1 | ▶ | if ( defined $value ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 1 | my $str = join( ',', sort @$value ); | |||||||||
| 26 | 1 | return $str; | |||||||||
| 27 | } | ||||||||||
| 28 | 0 | return; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 12 | ▶ | sub fif { | ||||||||
|
Subroutine
fif: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 32 | 12 | my $self = shift; | |||||||||
| 33 | 12 | my $fif = $self->next::method; | |||||||||
| 34 | 12 | ▶ | $fif = [] if $fif eq ''; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 12 | return $fif; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 1 | 1; | |||||||||
| 39 | |||||||||||
| 40 | __END__ | ||||||||||