line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::retain_field; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
104848
|
use Catmandu::Sane; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
21
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
16
|
use Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
8
|
2
|
|
|
2
|
|
739
|
use namespace::clean; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
20
|
|
9
|
2
|
|
|
2
|
|
1154
|
use Catmandu::Fix::Has; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
12
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::Fix::Base'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub emit { |
16
|
8
|
|
|
8
|
0
|
18
|
my ($self, $fixer) = @_; |
17
|
8
|
|
|
|
|
40
|
my $path = $fixer->split_path($self->path); |
18
|
8
|
|
|
|
|
17
|
my $key = pop @$path; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$fixer->emit_walk_path( |
21
|
|
|
|
|
|
|
$fixer->var, |
22
|
|
|
|
|
|
|
$path, |
23
|
|
|
|
|
|
|
sub { |
24
|
8
|
|
|
8
|
|
15
|
my $var = shift; |
25
|
8
|
|
|
|
|
26
|
$fixer->emit_retain_key($var, $key); |
26
|
|
|
|
|
|
|
} |
27
|
8
|
|
|
|
|
160
|
); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=pod |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Catmandu::Fix::retain_field - delete everything from a field except |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 DEPRECIATION NOTICE |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
This fix is deprecated, Please use L<Catmandu::Fix::retain> instead. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Delete every key from foo except bar |
47
|
|
|
|
|
|
|
retain_field(foo.bar) |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SEE ALSO |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
L<Catmandu::Fix> |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |