blib/lib/Catmandu/Fix/remove_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/from_json.pm ↑ Summary blib/lib/Catmandu/Fix/retain_field.pm »
1 package Catmandu::Fix::remove_field;
2  
3 3 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 our $VERSION = '1.0201_02';
6  
7 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 with 'Catmandu::Fix::Base';
12  
13 3 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_delete_key($var, $key);
26 }
27 8 );
28 }
29  
30 3 1;
31  
32 __END__
33  
34 =pod
35  
36 =head1 NAME
37  
38 Catmandu::Fix::remove_field - remove a field form the data
39  
40 =head1 SYNOPSIS
41  
42 # Remove the foo.bar field
43 remove_field(foo.bar)
44  
45 =head1 SEE ALSO
46  
47 L<Catmandu::Fix>
48  
49 =cut
« blib/lib/Catmandu/Fix/from_json.pm ↑ Summary blib/lib/Catmandu/Fix/retain_field.pm »