lib/HTML/FormFu/Role/Filter/Compound.pm

filter: Statementstmt 100% 25 / 25 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 97.0% 33 / 34 SCAR 17.9
CC
6
Cov
97%
_get_values
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.0
« lib/HTML/FormFu/Element/URL.pm ↑ Summary lib/HTML/FormFu/Processor.pm »
1 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package HTML::FormFu::Role::Filter::Compound;
4 8 $HTML::FormFu::Role::Filter::Compound::VERSION = '2.06';
5 # ABSTRACT: Role for Compound filters
6  
7 8 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 8 has field_order => ( is => 'rw', traits => ['Chained'] );
10  
11 sub _get_values {
12 7 ▶ my ( $self, $value ) = @_;
Subroutine _get_values: called CC=6 SCAR=17.9
13  
14 7 my ( $multi, @fields ) = @{ $self->parent->get_fields };
15  
16 7 ▶ if ( my $order = $self->field_order ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $order = $self->field_order) 2 5 7
17 2 my @new_order;
18  
19 FIELD:
20 2 for my $i (@$order) {
21 5 for my $field (@fields) {
22 9 ▶ if ( $field->name eq $i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($field->name eq $i) 5 4 9
23 5 push @new_order, $field;
24 5 next FIELD;
25 }
26 }
27 }
28  
29 2 @fields = @new_order;
30 }
31  
32 7 my @names = map { $_->name } @fields;
33  
34 7 ▶ return map { defined $_ ? $_ : '' } @{$value}{@names};
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 17 0 17
35 }
36  
37 8 1;
38  
39 __END__
40  
41 =pod
42  
43 =encoding UTF-8
44  
45 =head1 NAME
46  
47 HTML::FormFu::Role::Filter::Compound - Role for Compound filters
48  
49 =head1 VERSION
50  
51 version 2.06
52  
53 =head1 METHODS
54  
55 =head2 field_order
56  
57 Arguments: \@order
58  
59 If the submitted parts should be joined in an order different than that of the
60 order of the fields, you must provide an arrayref containing the names, in the
61 order they should be joined.
62  
63 ---
64 element:
65 - type: Multi
66 name: address
67  
68 elements:
69 - name: street
70 - name: number
71  
72 filter:
73 - type: CompoundJoin
74 field_order:
75 - number
76 - street
77  
78 =head1 AUTHOR
79  
80 Carl Franks, C<cfranks@cpan.org>
81  
82 =head1 LICENSE
83  
84 This library is free software, you can redistribute it and/or modify it under
85 the same terms as Perl itself.
86  
87 =head1 AUTHOR
88  
89 Carl Franks <cpan@fireartist.com>
90  
91 =head1 COPYRIGHT AND LICENSE
92  
93 This software is copyright (c) 2018 by Carl Franks.
94  
95 This is free software; you can redistribute it and/or modify it under
96 the same terms as the Perl 5 programming language system itself.
97  
98 =cut
« lib/HTML/FormFu/Element/URL.pm ↑ Summary lib/HTML/FormFu/Processor.pm »