line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::join_field; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
104886
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
8
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
8
|
1
|
|
|
1
|
|
975
|
use Catmandu::Util::Path qw(as_path); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
55
|
|
9
|
1
|
|
|
1
|
|
8
|
use Catmandu::Util qw(is_value); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
10
|
1
|
|
|
1
|
|
6
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
11
|
1
|
|
|
1
|
|
755
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
14
|
|
|
|
|
|
|
has join_char => (fix_arg => 1, default => sub {''}); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
with 'Catmandu::Fix::Builder'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _build_fixer { |
19
|
5
|
|
|
5
|
|
43
|
my ($self) = @_; |
20
|
5
|
|
|
|
|
14
|
my $join_char = $self->join_char; |
21
|
|
|
|
|
|
|
as_path($self->path)->updater( |
22
|
|
|
|
|
|
|
if_array_ref => sub { |
23
|
5
|
|
|
5
|
|
10
|
join $join_char, grep {is_value($_)} @{$_[0]}; |
|
20
|
|
|
|
|
140
|
|
|
5
|
|
|
|
|
14
|
|
24
|
|
|
|
|
|
|
} |
25
|
5
|
|
|
|
|
46
|
); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=pod |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 NAME |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Catmandu::Fix::join_field - join the ARRAY values of a field into a string |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 SYNOPSIS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Join the array values of a field into a string. E.g. foo => [1,2,3] |
41
|
|
|
|
|
|
|
join_field(foo, /) # foo => "1/2/3" |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SEE ALSO |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
L<Catmandu::Fix> |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |