line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
1855
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
159
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::FormFu::Transformer; |
4
|
|
|
|
|
|
|
$HTML::FormFu::Transformer::VERSION = '2.07'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Transformer Base Class |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
19
|
use Moose; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
17
|
|
8
|
|
|
|
|
|
|
extends 'HTML::FormFu::Processor'; |
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
22883
|
use HTML::FormFu::Exception::Transformer; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
160
|
|
11
|
3
|
|
|
3
|
|
31
|
use Scalar::Util qw( blessed ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1045
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub process { |
14
|
5
|
|
|
5
|
0
|
13
|
my ( $self, $values, $params ) = @_; |
15
|
|
|
|
|
|
|
|
16
|
5
|
|
|
|
|
11
|
my $return; |
17
|
|
|
|
|
|
|
my @errors; |
18
|
|
|
|
|
|
|
|
19
|
5
|
100
|
|
|
|
27
|
if ( ref $values eq 'ARRAY' ) { |
20
|
2
|
|
|
|
|
5
|
my @return; |
21
|
2
|
|
|
|
|
6
|
for my $value (@$values) { |
22
|
6
|
|
|
|
|
11
|
my ($return) = eval { $self->transformer( $value, $params ) }; |
|
6
|
|
|
|
|
17
|
|
23
|
|
|
|
|
|
|
|
24
|
6
|
50
|
|
|
|
17
|
if ($@) { |
25
|
0
|
|
|
|
|
0
|
push @errors, $self->return_error($@); |
26
|
0
|
|
|
|
|
0
|
push @return, undef; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else { |
29
|
6
|
|
|
|
|
15
|
push @return, $return; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
2
|
|
|
|
|
7
|
$return = \@return; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else { |
35
|
3
|
|
|
|
|
8
|
($return) = eval { $self->transformer( $values, $params ) }; |
|
3
|
|
|
|
|
15
|
|
36
|
|
|
|
|
|
|
|
37
|
3
|
50
|
|
|
|
33
|
if ($@) { |
38
|
0
|
|
|
|
|
0
|
push @errors, $self->return_error($@); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
5
|
|
|
|
|
22
|
$self->set_nested_hash_value( $params, $self->nested_name, $return ); |
43
|
|
|
|
|
|
|
|
44
|
5
|
|
|
|
|
160
|
return (@errors); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub return_error { |
48
|
0
|
|
|
0
|
0
|
|
my ( $self, $err ) = @_; |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
0
|
|
|
|
if ( !blessed $err || !$err->isa('HTML::FormFu::Exception::Transformer') ) { |
51
|
0
|
|
|
|
|
|
$err = HTML::FormFu::Exception::Transformer->new; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return $err; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=pod |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=encoding UTF-8 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
HTML::FormFu::Transformer - Transformer Base Class |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 VERSION |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
version 2.07 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SYNOPSIS |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 METHODS |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 CORE TRANSFORMERS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item L<HTML::FormFu::Transformer::Callback> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=back |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 AUTHOR |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Carl Franks, C<cfranks@cpan.org> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 LICENSE |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
96
|
|
|
|
|
|
|
the same terms as Perl itself. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 AUTHOR |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Carl Franks <cpan@fireartist.com> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Carl Franks. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
107
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |