line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
6
|
|
|
6
|
|
818
|
use strict; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
384
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::FormFu::Filter::CompoundJoin; |
4
|
|
|
|
|
|
|
$HTML::FormFu::Filter::CompoundJoin::VERSION = '2.07'; |
5
|
|
|
|
|
|
|
# ABSTRACT: CompoundJoin filter |
6
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
38
|
use Moose; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
52
|
|
8
|
6
|
|
|
6
|
|
41041
|
use MooseX::Attribute::Chained; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
357
|
|
9
|
|
|
|
|
|
|
extends 'HTML::FormFu::Filter'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'HTML::FormFu::Role::Filter::Compound'; |
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
44
|
use HTML::FormFu::Constants qw( $EMPTY_STR $SPACE ); |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
1675
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has join => ( is => 'rw', traits => ['Chained'] ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub filter { |
18
|
5
|
|
|
5
|
0
|
16
|
my ( $self, $value ) = @_; |
19
|
|
|
|
|
|
|
|
20
|
5
|
50
|
33
|
|
|
71
|
return if !defined $value || $value eq $EMPTY_STR; |
21
|
|
|
|
|
|
|
|
22
|
5
|
100
|
|
|
|
258
|
my $join |
23
|
|
|
|
|
|
|
= defined $self->join |
24
|
|
|
|
|
|
|
? $self->join |
25
|
|
|
|
|
|
|
: $SPACE; |
26
|
|
|
|
|
|
|
|
27
|
5
|
|
|
|
|
40
|
my @values = $self->_get_values($value); |
28
|
|
|
|
|
|
|
|
29
|
5
|
|
|
|
|
16
|
@values = grep { $_ ne '' } @values; |
|
11
|
|
|
|
|
29
|
|
30
|
|
|
|
|
|
|
|
31
|
5
|
|
|
|
|
17
|
$value = join $join, @values; |
32
|
|
|
|
|
|
|
|
33
|
5
|
|
|
|
|
45
|
return $value; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=encoding UTF-8 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
HTML::FormFu::Filter::CompoundJoin - CompoundJoin filter |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 VERSION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
version 2.07 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 SYNOPSIS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
--- |
57
|
|
|
|
|
|
|
element: |
58
|
|
|
|
|
|
|
- type: Multi |
59
|
|
|
|
|
|
|
name: address |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
elements: |
62
|
|
|
|
|
|
|
- name: number |
63
|
|
|
|
|
|
|
- name: street |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
filter: |
66
|
|
|
|
|
|
|
- type: CompoundJoin |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# get the compound-value |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my $address = $form->param_value('address'); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 DESCRIPTION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
For use with a L<HTML::FormFu::Element::Multi> group of fields. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Joins the input from several fields into a single value. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 METHODS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 join |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Arguments: $string |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Default Value: C<' '> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
String used to join the individually submitted parts. Defaults to a single |
87
|
|
|
|
|
|
|
space. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 field_order |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Inherited. See L<HTML::FormFu::Filter::_Compound/field_order> for details. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
--- |
94
|
|
|
|
|
|
|
element: |
95
|
|
|
|
|
|
|
- type: Multi |
96
|
|
|
|
|
|
|
name: address |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
elements: |
99
|
|
|
|
|
|
|
- name: street |
100
|
|
|
|
|
|
|
- name: number |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
filter: |
103
|
|
|
|
|
|
|
- type: CompoundJoin |
104
|
|
|
|
|
|
|
field_order: |
105
|
|
|
|
|
|
|
- number |
106
|
|
|
|
|
|
|
- street |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 AUTHOR |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Carl Franks, C<cfranks@cpan.org> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 LICENSE |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
115
|
|
|
|
|
|
|
the same terms as Perl itself. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 AUTHOR |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Carl Franks <cpan@fireartist.com> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Carl Franks. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
126
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |