line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormFu::Inflator; |
2
|
|
|
|
|
|
|
|
3
|
400
|
|
|
400
|
|
1553
|
use strict; |
|
400
|
|
|
|
|
448
|
|
|
400
|
|
|
|
|
16191
|
|
4
|
|
|
|
|
|
|
our $VERSION = '2.05'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
400
|
|
|
400
|
|
1379
|
use Moose; |
|
400
|
|
|
|
|
411
|
|
|
400
|
|
|
|
|
1981
|
|
7
|
|
|
|
|
|
|
extends 'HTML::FormFu::Processor'; |
8
|
|
|
|
|
|
|
|
9
|
400
|
|
|
400
|
|
1815067
|
use HTML::FormFu::Exception::Inflator; |
|
400
|
|
|
|
|
940
|
|
|
400
|
|
|
|
|
13180
|
|
10
|
400
|
|
|
400
|
|
2245
|
use Scalar::Util qw( blessed ); |
|
400
|
|
|
|
|
468
|
|
|
400
|
|
|
|
|
97829
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub process { |
13
|
30
|
|
|
30
|
1
|
56
|
my ( $self, $values ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
30
|
|
|
|
|
45
|
my $return; |
16
|
|
|
|
|
|
|
my @errors; |
17
|
|
|
|
|
|
|
|
18
|
30
|
100
|
|
|
|
111
|
if ( ref $values eq 'ARRAY' ) { |
19
|
1
|
|
|
|
|
2
|
my @return; |
20
|
1
|
|
|
|
|
2
|
for my $value (@$values) { |
21
|
2
|
|
|
|
|
2
|
($return) = eval { $self->inflator($value) }; |
|
2
|
|
|
|
|
6
|
|
22
|
|
|
|
|
|
|
|
23
|
2
|
50
|
|
|
|
4
|
if ($@) { |
24
|
0
|
|
|
|
|
0
|
push @errors, $self->return_error($@); |
25
|
0
|
|
|
|
|
0
|
push @return, $value; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
else { |
28
|
2
|
|
|
|
|
4
|
push @return, $return; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
1
|
|
|
|
|
2
|
$return = \@return; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else { |
34
|
29
|
|
|
|
|
38
|
($return) = eval { $self->inflator($values) }; |
|
29
|
|
|
|
|
129
|
|
35
|
|
|
|
|
|
|
|
36
|
29
|
100
|
|
|
|
2466
|
if ($@) { |
37
|
3
|
|
|
|
|
26
|
push @errors, $self->return_error($@); |
38
|
3
|
|
|
|
|
7
|
$return = $values; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
30
|
|
|
|
|
110
|
return ( $return, @errors ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub return_error { |
46
|
3
|
|
|
3
|
0
|
7
|
my ( $self, $err ) = @_; |
47
|
|
|
|
|
|
|
|
48
|
3
|
50
|
33
|
|
|
18
|
if ( !blessed $err || !$err->isa('HTML::FormFu::Exception::Inflator') ) { |
49
|
3
|
|
|
|
|
115
|
$err = HTML::FormFu::Exception::Inflator->new; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
3
|
|
|
|
|
10
|
return $err; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
HTML::FormFu::Inflator - Inflator Base Class |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 VERSION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
version 2.05 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SYNOPSIS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $inflator = $form->inflator( $type, @names ); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 DESCRIPTION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Inflator Base Class. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 METHODS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 names |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Arguments: @names |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Return Value: @names |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Contains names of params to inflator. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 process |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Arguments: $form_result, \%params |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 CORE INFLATORS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=over |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item L<HTML::FormFu::Inflator::CompoundDateTime> |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item L<HTML::FormFu::Inflator::DateTime> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=back |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Carl Franks, C<cfranks@cpan.org> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 LICENSE |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
108
|
|
|
|
|
|
|
the same terms as Perl itself. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |