Catmandu/Fix/compact.pm

filter: Statementstmt 100% 20 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 100% 26 / 26 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Catmandu/Fix/clone.pm ↑ Summary Catmandu/Fix/copy.pm »
1 package Catmandu::Fix::compact;
2  
3 1 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '1.2025';
6  
7 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Catmandu::Util::Path qw(as_path);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 with 'Catmandu::Fix::Builder';
12  
13 1 has path => (fix_arg => 1);
14  
15 1 ▶sub _build_fixer {
Subroutine _build_fixer: called CC=1 SCAR=0.0
16 1 my ($self) = @_;
17 as_path($self->path)
18 1 ▶ ->updater(if_array_ref => sub {[grep defined, @{$_[0]}]});
Subroutine __ANON__: called CC=1 SCAR=0.0
19 }
20  
21 =head1 NAME
22  
23 Catmandu::Fix::compact - remove undefined values from an array
24  
25 =head1 SYNOPSIS
26  
27 # list => [undef,"hello",undef,"world"]
28 compact(list)
29 # list => ["Hello","world"]
30  
31 =head1 SEE ALSO
32  
33 L<Catmandu::Fix>
34  
35 =cut
36  
37 1 1;
« Catmandu/Fix/clone.pm ↑ Summary Catmandu/Fix/copy.pm »