| 1 | package HTML::FormHandler::TraitFor::Types; | ||||||||||
| 2 | # ABSTRACT: types used internally in FormHandler | ||||||||||
| 3 | 148 | $HTML::FormHandler::TraitFor::Types::VERSION = '0.410000'; | |||||||||
| 4 | 148 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 148 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 148 | subtype 'HFH::ArrayRefStr' | |||||||||
| 8 | => as 'ArrayRef[Str]'; | ||||||||||
| 9 | |||||||||||
| 10 | coerce 'HFH::ArrayRefStr' | ||||||||||
| 11 | => from 'Str' | ||||||||||
| 12 | => via { | ||||||||||
| 13 | 296 | ▶ | if( length $_ ) { return [$_] }; | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||
| 14 | 253 | return []; | |||||||||
| 15 | 148 | }; | |||||||||
| 16 | |||||||||||
| 17 | coerce 'HFH::ArrayRefStr' | ||||||||||
| 18 | => from 'Undef' | ||||||||||
| 19 | 0 | ▶ | => via { return []; }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 20 | |||||||||||
| 21 | 148 | subtype 'HFH::SelectOptions' | |||||||||
| 22 | => as 'ArrayRef[HashRef]'; | ||||||||||
| 23 | |||||||||||
| 24 | coerce 'HFH::SelectOptions' | ||||||||||
| 25 | => from 'ArrayRef[Str]' | ||||||||||
| 26 | => via { | ||||||||||
| 27 | 123 | ▶ | my @options = @$_; | ||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||
| 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 | 148 | }; | |||||||||
| 34 | |||||||||||
| 35 | coerce 'HFH::SelectOptions' | ||||||||||
| 36 | => from 'ArrayRef[ArrayRef]' | ||||||||||
| 37 | => via { | ||||||||||
| 38 | 8 | ▶ | my @options = @{ $_[0][0] }; | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 39 | 8 | my $opts; | |||||||||
| 40 | 8 | push @{$opts}, { value => $_, label => $_ } foreach @options; | |||||||||
| 41 | 8 | return $opts; | |||||||||
| 42 | 148 | }; | |||||||||
| 43 | |||||||||||
| 44 | 148 | ▶ | no Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 45 | 148 | 1; | |||||||||
| 46 | |||||||||||
| 47 | __END__ | ||||||||||
| 48 | |||||||||||
| 49 | =pod | ||||||||||
| 50 | |||||||||||
| 51 | =encoding UTF-8 | ||||||||||
| 52 | |||||||||||
| 53 | =head1 NAME | ||||||||||
| 54 | |||||||||||
| 55 | HTML::FormHandler::TraitFor::Types - types used internally in FormHandler | ||||||||||
| 56 | |||||||||||
| 57 | =head1 VERSION | ||||||||||
| 58 | |||||||||||
| 59 | version 0.410000 | ||||||||||
| 60 | |||||||||||
| 61 | =head1 AUTHOR | ||||||||||
| 62 | |||||||||||
| 63 | FormHandler Contributors - see HTML::FormHandler | ||||||||||
| 64 | |||||||||||
| 65 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 66 | |||||||||||
| 67 | This software is copyright (c) 2017 by Gerda Shank. | ||||||||||
| 68 | |||||||||||
| 69 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 70 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 71 | |||||||||||
| 72 | =cut | ||||||||||