blib/lib/Catmandu/Fix/uniq.pm

filter: Statementstmt 100% 21 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 96.4% 27 / 28 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/sum.pm ↑ Summary blib/lib/Catmandu/Fix/uri_encode.pm »
1 package Catmandu::Fix::uniq;
2  
3 1 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '1.0201_02';
6  
7 1 ▶use List::MoreUtils ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 has path => (fix_arg => 1);
13  
14 1 with 'Catmandu::Fix::SimpleGetValue';
15  
16 sub emit_value {
17 1 ▶ my ($self, $var, $fixer) = @_;
Subroutine emit_value: called CC=1 SCAR=0.0
Pod undocumented
18  
19 1 "if (is_array_ref(${var})) {"
20 . "no warnings 'uninitialized';"
21 . "${var} = [List::MoreUtils::uniq(\@{${var}})];" . "}";
22 }
23  
24 1 1;
25  
26 __END__
27  
28 =pod
29  
30 =head1 NAME
31  
32 Catmandu::Fix::uniq - strip duplicate values from an array
33  
34 =head1 SYNOPSIS
35  
36 # {tags => ["foo", "bar", "bar", "foo"]}
37 uniq(tags)
38 # {tags => ["foo", "bar"]}
39  
40 =head1 SEE ALSO
41  
42 L<Catmandu::Fix>
43  
44 =cut
« blib/lib/Catmandu/Fix/sum.pm ↑ Summary blib/lib/Catmandu/Fix/uri_encode.pm »