line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
404
|
|
|
404
|
|
2944
|
use strict; |
|
404
|
|
|
|
|
924
|
|
|
404
|
|
|
|
|
34052
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::FormFu::Inflator; |
4
|
|
|
|
|
|
|
$HTML::FormFu::Inflator::VERSION = '2.07'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Inflator Base Class |
6
|
|
|
|
|
|
|
|
7
|
404
|
|
|
404
|
|
2900
|
use Moose; |
|
404
|
|
|
|
|
764
|
|
|
404
|
|
|
|
|
2758
|
|
8
|
|
|
|
|
|
|
extends 'HTML::FormFu::Processor'; |
9
|
|
|
|
|
|
|
|
10
|
404
|
|
|
404
|
|
2900917
|
use HTML::FormFu::Exception::Inflator; |
|
404
|
|
|
|
|
1307
|
|
|
404
|
|
|
|
|
16826
|
|
11
|
404
|
|
|
404
|
|
3323
|
use Scalar::Util qw( blessed ); |
|
404
|
|
|
|
|
858
|
|
|
404
|
|
|
|
|
127548
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub process { |
14
|
30
|
|
|
30
|
1
|
116
|
my ( $self, $values ) = @_; |
15
|
|
|
|
|
|
|
|
16
|
30
|
|
|
|
|
89
|
my $return; |
17
|
|
|
|
|
|
|
my @errors; |
18
|
|
|
|
|
|
|
|
19
|
30
|
100
|
|
|
|
136
|
if ( ref $values eq 'ARRAY' ) { |
20
|
1
|
|
|
|
|
1
|
my @return; |
21
|
1
|
|
|
|
|
2
|
for my $value (@$values) { |
22
|
2
|
|
|
|
|
3
|
($return) = eval { $self->inflator($value) }; |
|
2
|
|
|
|
|
14
|
|
23
|
|
|
|
|
|
|
|
24
|
2
|
50
|
|
|
|
4
|
if ($@) { |
25
|
0
|
|
|
|
|
0
|
push @errors, $self->return_error($@); |
26
|
0
|
|
|
|
|
0
|
push @return, $value; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else { |
29
|
2
|
|
|
|
|
6
|
push @return, $return; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
1
|
|
|
|
|
3
|
$return = \@return; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else { |
35
|
29
|
|
|
|
|
66
|
($return) = eval { $self->inflator($values) }; |
|
29
|
|
|
|
|
290
|
|
36
|
|
|
|
|
|
|
|
37
|
29
|
100
|
|
|
|
3256
|
if ($@) { |
38
|
3
|
|
|
|
|
35
|
push @errors, $self->return_error($@); |
39
|
3
|
|
|
|
|
8
|
$return = $values; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
30
|
|
|
|
|
143
|
return ( $return, @errors ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub return_error { |
47
|
3
|
|
|
3
|
0
|
13
|
my ( $self, $err ) = @_; |
48
|
|
|
|
|
|
|
|
49
|
3
|
50
|
33
|
|
|
23
|
if ( !blessed $err || !$err->isa('HTML::FormFu::Exception::Inflator') ) { |
50
|
3
|
|
|
|
|
151
|
$err = HTML::FormFu::Exception::Inflator->new; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
3
|
|
|
|
|
12
|
return $err; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=pod |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=encoding UTF-8 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 NAME |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
HTML::FormFu::Inflator - Inflator Base Class |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 VERSION |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
version 2.07 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SYNOPSIS |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $inflator = $form->inflator( $type, @names ); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 DESCRIPTION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Inflator Base Class. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 METHODS |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 names |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Arguments: @names |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Return Value: @names |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Contains names of params to inflator. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 process |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Arguments: $form_result, \%params |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 CORE INFLATORS |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item L<HTML::FormFu::Inflator::CompoundDateTime> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item L<HTML::FormFu::Inflator::DateTime> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=back |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 AUTHOR |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Carl Franks, C<cfranks@cpan.org> |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 LICENSE |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
113
|
|
|
|
|
|
|
the same terms as Perl itself. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 AUTHOR |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Carl Franks <cpan@fireartist.com> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Carl Franks. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
124
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |