line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
10
|
|
|
10
|
|
93065
|
|
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
67
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
10
|
|
|
10
|
|
65
|
use Catmandu::Util::Path qw(as_path); |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
55
|
|
8
|
10
|
|
|
10
|
|
4472
|
use Clone qw(clone); |
|
10
|
|
|
|
|
23
|
|
|
10
|
|
|
|
|
495
|
|
9
|
10
|
|
|
10
|
|
55
|
use namespace::clean; |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
372
|
|
10
|
10
|
|
|
10
|
|
50
|
use Catmandu::Fix::Has; |
|
10
|
|
|
|
|
27
|
|
|
10
|
|
|
|
|
55
|
|
11
|
10
|
|
|
10
|
|
4466
|
|
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
64
|
|
12
|
|
|
|
|
|
|
with 'Catmandu::Fix::Builder'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has old_path => (fix_arg => 1); |
15
|
|
|
|
|
|
|
has new_path => (fix_arg => 1); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my ($self) = @_; |
18
|
|
|
|
|
|
|
my $old_path = as_path($self->old_path); |
19
|
29
|
|
|
29
|
|
236
|
my $new_path = as_path($self->new_path); |
20
|
29
|
|
|
|
|
126
|
my $getter = $old_path->getter; |
21
|
29
|
|
|
|
|
2594
|
my $creator = $new_path->creator; |
22
|
29
|
|
|
|
|
472
|
|
23
|
29
|
|
|
|
|
536
|
sub { |
24
|
|
|
|
|
|
|
my $data = $_[0]; |
25
|
|
|
|
|
|
|
my $values = [map {clone($_)} @{$getter->($data)}]; |
26
|
55
|
|
|
55
|
|
77
|
while (@$values) { |
27
|
55
|
|
|
|
|
70
|
$data = $creator->($data, shift @$values); |
|
58
|
|
|
|
|
305
|
|
|
55
|
|
|
|
|
773
|
|
28
|
55
|
|
|
|
|
150
|
} |
29
|
58
|
|
|
|
|
918
|
$data; |
30
|
|
|
|
|
|
|
}; |
31
|
55
|
|
|
|
|
779
|
} |
32
|
29
|
|
|
|
|
253
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Catmandu::Fix::copy_field - copy the value of one field to a new field |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SYNOPSIS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Copy the values of foo.bar into bar.foo |
45
|
|
|
|
|
|
|
copy_field(foo.bar, bar.foo) |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SEE ALSO |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
L<Catmandu::Fix> |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |