line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
86421
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
1
|
|
|
1
|
|
6
|
use Catmandu::Util qw(is_value is_code_ref); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
8
|
1
|
|
|
1
|
|
290
|
use Catmandu::Util::Path qw(as_path); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
9
|
1
|
|
|
1
|
|
348
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
10
|
1
|
|
|
1
|
|
6
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
11
|
1
|
|
|
1
|
|
582
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
12
|
|
|
|
|
|
|
with 'Catmandu::Fix::Builder'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
15
|
|
|
|
|
|
|
has args => (fix_arg => 'collect'); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my ($self) = @_; |
18
|
|
|
|
|
|
|
my $args = $self->args; |
19
|
3
|
|
|
3
|
|
24
|
my $join_char = ' '; |
20
|
3
|
|
|
|
|
8
|
my $getters = []; |
21
|
3
|
|
|
|
|
5
|
my $creator = as_path($self->path)->creator; |
22
|
3
|
|
|
|
|
5
|
|
23
|
3
|
|
|
|
|
36
|
for (my $i = 0; $i < @$args; $i++) { |
24
|
|
|
|
|
|
|
my $arg = $args->[$i]; |
25
|
3
|
|
|
|
|
19
|
if ($arg eq 'join_char') { |
26
|
10
|
|
|
|
|
23
|
$join_char = $args->[$i + 1]; |
27
|
10
|
100
|
|
|
|
32
|
last; |
|
|
100
|
|
|
|
|
|
28
|
1
|
|
|
|
|
2
|
} |
29
|
1
|
|
|
|
|
3
|
elsif (my ($literal) = $arg =~ /^~(.*)/) { |
30
|
|
|
|
|
|
|
push @$getters, $literal; |
31
|
|
|
|
|
|
|
} |
32
|
1
|
|
|
|
|
3
|
else { |
33
|
|
|
|
|
|
|
push @$getters, as_path($arg)->getter; |
34
|
|
|
|
|
|
|
} |
35
|
8
|
|
|
|
|
20
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub { |
38
|
|
|
|
|
|
|
my $data = $_[0]; |
39
|
|
|
|
|
|
|
my $vals = []; |
40
|
3
|
|
|
3
|
|
5
|
for my $getter (@$getters) { |
41
|
3
|
|
|
|
|
6
|
if (is_code_ref($getter)) { |
42
|
3
|
|
|
|
|
7
|
push @$vals, grep {is_value($_)} @{$getter->($data)}; |
43
|
9
|
100
|
|
|
|
19
|
} |
44
|
8
|
|
|
|
|
10
|
else { |
|
8
|
|
|
|
|
28
|
|
|
8
|
|
|
|
|
119
|
|
45
|
|
|
|
|
|
|
push @$vals, $getter; |
46
|
|
|
|
|
|
|
} |
47
|
1
|
|
|
|
|
2
|
} |
48
|
|
|
|
|
|
|
$creator->($data, join($join_char, @$vals)); |
49
|
|
|
|
|
|
|
$data; |
50
|
3
|
|
|
|
|
58
|
}; |
51
|
3
|
|
|
|
|
44
|
} |
52
|
3
|
|
|
|
|
22
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=pod |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Catmandu::Fix::paste - concatenate path values |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SYNOPSIS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# If you data record is: |
65
|
|
|
|
|
|
|
# a: eeny |
66
|
|
|
|
|
|
|
# b: meeny |
67
|
|
|
|
|
|
|
# c: miny |
68
|
|
|
|
|
|
|
# d: moe |
69
|
|
|
|
|
|
|
paste(my.string,a,b,c,d) # my.string: eeny meeny miny moe |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Use a join character |
72
|
|
|
|
|
|
|
paste(my.string,a,b,c,d,join_char:", ") # my.string: eeny, meeny, miny, moe |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Paste literal strings with a tilde sign |
75
|
|
|
|
|
|
|
paste(my.string,~Hi,a,~how are you?) # my.string: Hi eeny how are you? |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Paste places a concatenation of all paths starting from the second path into the first path. |
80
|
|
|
|
|
|
|
Literal values can be pasted by prefixing them with a tilde (~) sign. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SEE ALSO |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
L<Catmandu::Fix> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |