lib/HTML/FormFu/Inflator.pm

filter: Statementstmt 94.7% 36 / 38 Branchbran 75.0% 6 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 50.0% 1 / 2 totaltotal 84.7% 50 / 59 SCAR 19.6
CC
7
Cov
88%
process
5.0
return_error
3.3
BEGIN
1.0
CRAP 7.1
« lib/HTML/FormFu/Constraint/Length.pm ↑ Summary lib/HTML/FormFu/Element/Password.pm »
1 403 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package HTML::FormFu::Inflator;
4 403 $HTML::FormFu::Inflator::VERSION = '2.06';
5 # ABSTRACT: Inflator Base Class
6  
7 403 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 403 extends 'HTML::FormFu::Processor';
9  
10 403 ▶use HTML::FormFu::Exception::Inflator;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 403 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub process {
14 30 ▶ my ( $self, $values ) = @_;
Subroutine process: called CC=5 SCAR=16.2
Pod documented
15  
16 30 my $return;
17 my @errors;
18  
19 30 ▶ if ( ref $values eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $values eq 'ARRAY') { } 1 29 30
20 1 my @return;
21 1 for my $value (@$values) {
22 2 ($return) = eval { $self->inflator($value) };
23  
24 2 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 2 2
25 0 push @errors, $self->return_error($@);
26 0 push @return, $value;
27 }
28 else {
29 2 push @return, $return;
30 }
31 }
32 1 $return = \@return;
33 }
34 else {
35 29 ($return) = eval { $self->inflator($values) };
36  
37 29 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 3 26 29
38 3 push @errors, $self->return_error($@);
39 3 $return = $values;
40 }
41 }
42  
43 30 return ( $return, @errors );
44 }
45  
46 sub return_error {
47 3 ▶ my ( $self, $err ) = @_;
Subroutine return_error: called CC=3 SCAR=12.0
Pod undocumented
48  
49 3 ▶ if ( !blessed $err || !$err->isa('HTML::FormFu::Exception::Inflator') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($err) and $err->isa("HTML::FormFu::Exception::Inflator")) 3 0 3
Condition33%1/3
builtin::blessed($err) and $err->isa("HTML::FormFu::Exception::Inflator")
!ll&&!rl&&r
300
MC/DC0%0/2
builtin::blessed($err) and $err->isa("HTML::FormFu::Exception::Inflator")
builtin::blessed($err) $err->isa("HTML::FormFu::Exception::Inflator")
Truth table33%1/3
A and B
A= builtin::blessed($err)B= $err->isa("HTML::FormFu::Exception::Inflator")
ABresult
0X0
100
111
50 3 $err = HTML::FormFu::Exception::Inflator->new;
51 }
52  
53 3 return $err;
54 }
55  
56 403 __PACKAGE__->meta->make_immutable;
57  
58 403 1;
59  
60 __END__
61  
62 =pod
63  
64 =encoding UTF-8
65  
66 =head1 NAME
67  
68 HTML::FormFu::Inflator - Inflator Base Class
69  
70 =head1 VERSION
71  
72 version 2.06
73  
74 =head1 SYNOPSIS
75  
76 my $inflator = $form->inflator( $type, @names );
77  
78 =head1 DESCRIPTION
79  
80 Inflator Base Class.
81  
82 =head1 METHODS
83  
84 =head2 names
85  
86 Arguments: @names
87  
88 Return Value: @names
89  
90 Contains names of params to inflator.
91  
92 =head2 process
93  
94 Arguments: $form_result, \%params
95  
96 =head1 CORE INFLATORS
97  
98 =over
99  
100 =item L<HTML::FormFu::Inflator::CompoundDateTime>
101  
102 =item L<HTML::FormFu::Inflator::DateTime>
103  
104 =back
105  
106 =head1 AUTHOR
107  
108 Carl Franks, C<cfranks@cpan.org>
109  
110 =head1 LICENSE
111  
112 This library is free software, you can redistribute it and/or modify it under
113 the same terms as Perl itself.
114  
115 =head1 AUTHOR
116  
117 Carl Franks <cpan@fireartist.com>
118  
119 =head1 COPYRIGHT AND LICENSE
120  
121 This software is copyright (c) 2018 by Carl Franks.
122  
123 This is free software; you can redistribute it and/or modify it under
124 the same terms as the Perl 5 programming language system itself.
125  
126 =cut
« lib/HTML/FormFu/Constraint/Length.pm ↑ Summary lib/HTML/FormFu/Element/Password.pm »