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