line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormHandler::TraitFor::Types; |
2
|
|
|
|
|
|
|
# ABSTRACT: types used internally in FormHandler |
3
|
|
|
|
|
|
|
$HTML::FormHandler::TraitFor::Types::VERSION = '0.40068'; |
4
|
145
|
|
|
145
|
|
95313
|
use Moose::Role; |
|
145
|
|
|
|
|
391
|
|
|
145
|
|
|
|
|
1199
|
|
5
|
145
|
|
|
145
|
|
747003
|
use Moose::Util::TypeConstraints; |
|
145
|
|
|
|
|
398
|
|
|
145
|
|
|
|
|
1377
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
subtype 'HFH::ArrayRefStr' |
8
|
|
|
|
|
|
|
=> as 'ArrayRef[Str]'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
coerce 'HFH::ArrayRefStr' |
11
|
|
|
|
|
|
|
=> from 'Str' |
12
|
|
|
|
|
|
|
=> via { |
13
|
|
|
|
|
|
|
if( length $_ ) { return [$_] }; |
14
|
|
|
|
|
|
|
return []; |
15
|
|
|
|
|
|
|
}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
coerce 'HFH::ArrayRefStr' |
18
|
|
|
|
|
|
|
=> from 'Undef' |
19
|
|
|
|
|
|
|
=> via { return []; }; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
subtype 'HFH::SelectOptions' |
22
|
|
|
|
|
|
|
=> as 'ArrayRef[HashRef]'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
coerce 'HFH::SelectOptions' |
25
|
|
|
|
|
|
|
=> from 'ArrayRef[Str]' |
26
|
|
|
|
|
|
|
=> via { |
27
|
|
|
|
|
|
|
my @options = @$_; |
28
|
|
|
|
|
|
|
die "Options array must contain an even number of elements" |
29
|
|
|
|
|
|
|
if @options % 2; |
30
|
|
|
|
|
|
|
my $opts; |
31
|
|
|
|
|
|
|
push @{$opts}, { value => shift @options, label => shift @options } while @options; |
32
|
|
|
|
|
|
|
return $opts; |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
coerce 'HFH::SelectOptions' |
36
|
|
|
|
|
|
|
=> from 'ArrayRef[ArrayRef]' |
37
|
|
|
|
|
|
|
=> via { |
38
|
|
|
|
|
|
|
my @options = @{ $_[0][0] }; |
39
|
|
|
|
|
|
|
my $opts; |
40
|
|
|
|
|
|
|
push @{$opts}, { value => $_, label => $_ } foreach @options; |
41
|
|
|
|
|
|
|
return $opts; |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
145
|
|
|
145
|
|
359636
|
no Moose::Util::TypeConstraints; |
|
145
|
|
|
|
|
388
|
|
|
145
|
|
|
|
|
880
|
|
45
|
|
|
|
|
|
|
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.40068 |
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 |