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