| 1 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | package HTML::FormFu::Inflator::Callback; | ||||||||||||||||||||
| 4 | 2 | $HTML::FormFu::Inflator::Callback::VERSION = '2.06'; | |||||||||||||||||||
| 5 | # ABSTRACT: Callback inflator | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 2 | ▶ | use Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 2 | ▶ | use MooseX::Attribute::Chained; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 2 | extends 'HTML::FormFu::Inflator'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 2 | has callback => ( is => 'rw', traits => ['Chained'] ); | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | sub inflator { | ||||||||||||||||||||
| 14 | 2 | ▶ | my ( $self, $value ) = @_; | ||||||||||||||||||
|
Subroutine
inflator: called CC=2 SCAR=7.5
Pod
undocumented
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 2 | ▶ | my $callback = $self->callback || sub {shift}; | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.0
Condition33%1/3
$self->callback || sub {
MC/DC0%0/2
$self->callback || sub {
shift();
}
$self->callback
sub {
shift();
}
Truth table33%1/3
A || B
A= $self->callbackB= sub {
shift();
}
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | ## no critic (ProhibitNoStrict); | ||||||||||||||||||||
| 19 | 2 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 2 | return $callback->($value); | |||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 2 | 1; | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | __END__ | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | =pod | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | =encoding UTF-8 | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | =head1 NAME | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | HTML::FormFu::Inflator::Callback - Callback inflator | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | =head1 VERSION | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | version 2.06 | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | =head1 SYNOPSIS | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | $field->inflator('Callback')->callback( \&my_callback ); | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | --- | ||||||||||||||||||||
| 47 | elements: | ||||||||||||||||||||
| 48 | - type: Text | ||||||||||||||||||||
| 49 | name: foo | ||||||||||||||||||||
| 50 | inflators: | ||||||||||||||||||||
| 51 | - type: Callback | ||||||||||||||||||||
| 52 | callback: "main::my_inflator" | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | =head1 DESCRIPTION | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | Callback inflator. | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | =head1 METHODS | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | =head2 callback | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | Arguments: \&code-reference | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | Arguments: "subroutine-name" | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | =head1 SEE ALSO | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | Is a sub-class of, and inherits methods from L<HTML::FormFu::Inflator> | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | L<HTML::FormFu::FormFu> | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | =head1 AUTHOR | ||||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | Carl Franks C<cfranks@cpan.org> | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | =head1 LICENSE | ||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | This library is free software, you can redistribute it and/or modify it under | ||||||||||||||||||||
| 79 | the same terms as Perl itself. | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | =head1 AUTHOR | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | Carl Franks <cpan@fireartist.com> | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | This software is copyright (c) 2018 by Carl Franks. | ||||||||||||||||||||
| 88 | |||||||||||||||||||||
| 89 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||
| 90 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | =cut | ||||||||||||||||||||