lib/HTML/FormFu/Deflator/Callback.pm

filter: Statementstmt 95.2% 20 / 21 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 78.7% 26 / 33 SCAR 7.0
CC
2
Cov
88%
deflator
2.1
__ANON__
1.2
BEGIN
1.0
CRAP 2.0
« lib/HTML/FormFu/Exception/Validator.pm ↑ Summary lib/HTML/FormFu/Inflator/Callback.pm »
1 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package HTML::FormFu::Deflator::Callback;
4 3 $HTML::FormFu::Deflator::Callback::VERSION = '2.06';
5 # ABSTRACT: Callback deflator
6  
7 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use MooseX::Attribute::Chained;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 extends 'HTML::FormFu::Deflator';
10  
11 3 has callback => ( is => 'rw', traits => ['Chained'] );
12  
13 sub deflator {
14 3 ▶ my ( $self, $value ) = @_;
Subroutine deflator: called CC=2 SCAR=7.5
Pod undocumented
15  
16 3 ▶ my $callback = $self->callback || sub {shift};
Subroutine __ANON__: not called CC=1 SCAR=2.0
Condition33%1/3
$self->callback || sub {
l!l&&r!l&&!r
300
MC/DC0%0/2
$self->callback || sub { shift(); }
$self->callback sub { shift(); }
Truth table33%1/3
A || B
A= $self->callbackB= sub { shift(); }
ABresult
1X1
011
000
17  
18 ## no critic (ProhibitNoStrict);
19 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 3 return $callback->($value);
22 }
23  
24 3 __PACKAGE__->meta->make_immutable;
25  
26 3 1;
27  
28 __END__
29  
30 =pod
31  
32 =encoding UTF-8
33  
34 =head1 NAME
35  
36 HTML::FormFu::Deflator::Callback - Callback deflator
37  
38 =head1 VERSION
39  
40 version 2.06
41  
42 =head1 SYNOPSIS
43  
44 $field->deflator('Callback')->callback( \&my_callback );
45  
46 ---
47 elements:
48 - type: Text
49 name: foo
50 deflators:
51 - type: Callback
52 callback: "main::my_deflator"
53  
54 =head1 DESCRIPTION
55  
56 Callback deflator.
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::Deflator>
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
« lib/HTML/FormFu/Exception/Validator.pm ↑ Summary lib/HTML/FormFu/Inflator/Callback.pm »