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