| 1 | package HTML::FormHandler::TraitFor::Types; | ||||||||||
| 2 | # ABSTRACT: types used internally in FormHandler | ||||||||||
| 3 | 149 | $HTML::FormHandler::TraitFor::Types::VERSION = '0.410002'; | |||||||||
| 4 | 149 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 149 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 149 | subtype 'HFH::ArrayRefStr' | |||||||||
| 8 | => as 'ArrayRef[Str]'; | ||||||||||
| 9 | |||||||||||
| 10 | coerce 'HFH::ArrayRefStr' | ||||||||||
| 11 | => from 'Str' | ||||||||||
| 12 | 297 | ▶ | => via { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 13 | 297 | ▶ | if( length $_ ) { return [$_] }; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 254 | return []; | |||||||||
| 15 | 149 | }; | |||||||||
| 16 | |||||||||||
| 17 | coerce 'HFH::ArrayRefStr' | ||||||||||
| 18 | => from 'Undef' | ||||||||||
| 19 | 0 | ▶ | => via { return []; }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 20 | |||||||||||
| 21 | 149 | subtype 'HFH::SelectOptions' | |||||||||
| 22 | => as 'ArrayRef[HashRef]'; | ||||||||||
| 23 | |||||||||||
| 24 | coerce 'HFH::SelectOptions' | ||||||||||
| 25 | => from 'ArrayRef[Str]' | ||||||||||
| 26 | 123 | ▶ | => via { | ||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||
| 27 | 123 | my @options = @$_; | |||||||||
| 28 | 123 | ▶ | die "Options array must contain an even number of elements" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | if @options % 2; | ||||||||||
| 30 | 123 | my $opts; | |||||||||
| 31 | 123 | ▶ | push @{$opts}, { value => shift @options, label => shift @options } while @options; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 123 | return $opts; | |||||||||
| 33 | 149 | }; | |||||||||
| 34 | |||||||||||
| 35 | coerce 'HFH::SelectOptions' | ||||||||||
| 36 | => from 'ArrayRef[ArrayRef]' | ||||||||||
| 37 | 8 | ▶ | => via { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 38 | 8 | my @options = @{ $_[0][0] }; | |||||||||
| 39 | 8 | my $opts; | |||||||||
| 40 | 8 | push @{$opts}, { value => $_, label => $_ } foreach @options; | |||||||||
| 41 | 8 | return $opts; | |||||||||
| 42 | 149 | }; | |||||||||
| 43 | |||||||||||
| 44 | 149 | ▶ | no Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 45 | 149 | 1; | |||||||||
| 46 | |||||||||||
| 47 | __END__ | ||||||||||