lib/HTML/FormFu/Transformer.pm

filter: Statementstmt 81.5% 31 / 38 Branchbran 50.0% 4 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 2 totaltotal 67.8% 40 / 59 SCAR 21.0
CC
7
Cov
71%
return_error
12.0
process
5.2
BEGIN
1.0
CRAP 8.1
« lib/HTML/FormFu/Constraint/File/MIME.pm ↑ Summary lib/HTML/FormFu/Constraint/Range.pm »
1 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package HTML::FormFu::Transformer;
4 3 $HTML::FormFu::Transformer::VERSION = '2.06';
5 # ABSTRACT: Transformer Base Class
6  
7 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 extends 'HTML::FormFu::Processor';
9  
10 3 ▶use HTML::FormFu::Exception::Transformer;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub process {
14 5 ▶ my ( $self, $values, $params ) = @_;
Subroutine process: called CC=5 SCAR=16.5
Pod undocumented
15  
16 5 my $return;
17 my @errors;
18  
19 5 ▶ if ( ref $values eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $values eq 'ARRAY') { } 2 3 5
20 2 my @return;
21 2 for my $value (@$values) {
22 6 my ($return) = eval { $self->transformer( $value, $params ) };
23  
24 6 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 6 6
25 0 push @errors, $self->return_error($@);
26 0 push @return, undef;
27 }
28 else {
29 6 push @return, $return;
30 }
31 }
32 2 $return = \@return;
33 }
34 else {
35 3 ($return) = eval { $self->transformer( $values, $params ) };
36  
37 3 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 3 3
38 0 push @errors, $self->return_error($@);
39 }
40 }
41  
42 5 $self->set_nested_hash_value( $params, $self->nested_name, $return );
43  
44 5 return (@errors);
45 }
46  
47 sub return_error {
48 0 ▶ my ( $self, $err ) = @_;
Subroutine return_error: not called CC=3 SCAR=24.8
Pod undocumented
49  
50 0 ▶ if ( !blessed $err || !$err->isa('HTML::FormFu::Exception::Transformer') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($err) and $err->isa("HTML::FormFu::Exception::Transformer")) 0 0 0
Condition0%0/3
builtin::blessed($err) and $err->isa("HTML::FormFu::Exception::Transformer")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($err) and $err->isa("HTML::FormFu::Exception::Transformer")
builtin::blessed($err) $err->isa("HTML::FormFu::Exception::Transformer")
Truth table0%0/3
A and B
A= builtin::blessed($err)B= $err->isa("HTML::FormFu::Exception::Transformer")
ABresult
0X0
100
111
51 0 $err = HTML::FormFu::Exception::Transformer->new;
52 }
53  
54 0 return $err;
55 }
56  
57 3 __PACKAGE__->meta->make_immutable;
58  
59 3 1;
60  
61 __END__
62  
63 =pod
64  
65 =encoding UTF-8
66  
67 =head1 NAME
68  
69 HTML::FormFu::Transformer - Transformer Base Class
70  
71 =head1 VERSION
72  
73 version 2.06
74  
75 =head1 SYNOPSIS
76  
77 =head1 DESCRIPTION
78  
79 =head1 METHODS
80  
81 =head1 CORE TRANSFORMERS
82  
83 =over
84  
85 =item L<HTML::FormFu::Transformer::Callback>
86  
87 =back
88  
89 =head1 AUTHOR
90  
91 Carl Franks, C<cfranks@cpan.org>
92  
93 =head1 LICENSE
94  
95 This library is free software, you can redistribute it and/or modify it under
96 the same terms as Perl itself.
97  
98 =head1 AUTHOR
99  
100 Carl Franks <cpan@fireartist.com>
101  
102 =head1 COPYRIGHT AND LICENSE
103  
104 This software is copyright (c) 2018 by Carl Franks.
105  
106 This is free software; you can redistribute it and/or modify it under
107 the same terms as the Perl 5 programming language system itself.
108  
109 =cut
« lib/HTML/FormFu/Constraint/File/MIME.pm ↑ Summary lib/HTML/FormFu/Constraint/Range.pm »