line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
1551
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
211
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::FormFu::Transformer::Callback; |
4
|
|
|
|
|
|
|
$HTML::FormFu::Transformer::Callback::VERSION = '2.07'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Callback transformer |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
20
|
use Moose; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
27
|
|
8
|
3
|
|
|
3
|
|
21831
|
use MooseX::Attribute::Chained; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
380
|
|
9
|
|
|
|
|
|
|
extends 'HTML::FormFu::Transformer'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has callback => ( is => 'rw', traits => ['Chained'] ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub transformer { |
14
|
9
|
|
|
9
|
0
|
207
|
my ( $self, $value, $params ) = @_; |
15
|
|
|
|
|
|
|
|
16
|
9
|
|
50
|
0
|
|
295
|
my $callback = $self->callback || sub {1}; |
|
0
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
## no critic (ProhibitNoStrict); |
19
|
3
|
|
|
3
|
|
23
|
no strict 'refs'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
293
|
|
20
|
|
|
|
|
|
|
|
21
|
9
|
|
|
|
|
36
|
my $return = $callback->( $value, $params ); |
22
|
|
|
|
|
|
|
|
23
|
9
|
|
|
|
|
97
|
return $return; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=pod |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=encoding UTF-8 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
HTML::FormFu::Transformer::Callback - Callback transformer |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 VERSION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
version 2.07 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$field->transformer('Callback')->callback( \&my_transformer ); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
--- |
49
|
|
|
|
|
|
|
elements: |
50
|
|
|
|
|
|
|
- type: Text |
51
|
|
|
|
|
|
|
name: foo |
52
|
|
|
|
|
|
|
transformers: |
53
|
|
|
|
|
|
|
- type: Callback |
54
|
|
|
|
|
|
|
callback: "main::my_transformer" |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
The first argument passed to the callback is the submitted value for the |
59
|
|
|
|
|
|
|
associated field. The second argument passed to the callback is a hashref of |
60
|
|
|
|
|
|
|
name/value pairs for all input fields. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 METHODS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 callback |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Arguments: \&code-reference |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Arguments: "subroutine-name" |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 SEE ALSO |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Is a sub-class of, and inherits methods from L<HTML::FormFu::Transformer> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
L<HTML::FormFu> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHOR |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Carl Franks C<cfranks@cpan.org> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 LICENSE |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
83
|
|
|
|
|
|
|
the same terms as Perl itself. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Carl Franks <cpan@fireartist.com> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Carl Franks. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
94
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |