blib/lib/Catmandu/Fix/retain_field.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 96.5% 28 / 29 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Catmandu/Fix/remove_field.pm ↑ Summary blib/lib/Catmandu/Fix/to_json.pm »
1 package Catmandu::Fix::retain_field;
2  
3 2 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 our $VERSION = '1.0201_02';
6  
7 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 with 'Catmandu::Fix::Base';
12  
13 2 has path => (fix_arg => 1);
14  
15 sub emit {
16 8 ▶ my ($self, $fixer) = @_;
Subroutine emit: called CC=1 SCAR=0.0
Pod undocumented
17 8 my $path = $fixer->split_path($self->path);
18 8 my $key = pop @$path;
19  
20 $fixer->emit_walk_path(
21 $fixer->var,
22 $path,
23 sub {
24 8 ▶ my $var = shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
25 8 $fixer->emit_retain_key($var, $key);
26 }
27 8 );
28 }
29  
30 2 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
« blib/lib/Catmandu/Fix/remove_field.pm ↑ Summary blib/lib/Catmandu/Fix/to_json.pm »