blib/lib/Catmandu/Fix/reverse.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 95.8% 23 / 24 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/hash.pm ↑ Summary blib/lib/Catmandu/Fix/upcase.pm »
1 package Catmandu::Fix::reverse;
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 Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use namespace::clean;
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 has path => (fix_arg => 1);
12  
13 1 with 'Catmandu::Fix::SimpleGetValue';
14  
15 sub emit_value {
16 2 ▶ my ($self, $var, $fixer) = @_;
Subroutine emit_value: called CC=1 SCAR=0.0
Pod undocumented
17  
18 2 "if (is_array_ref(${var})) {"
19 . "${var} = [reverse(\@{${var}})];" . "}"
20 . "elsif (is_string(${var})) {"
21 . "${var} = scalar(reverse(${var}));" . "}";
22 }
23  
24 1 1;
25  
26 __END__
27  
28 =pod
29  
30 =head1 NAME
31  
32 Catmandu::Fix::reverse - reverse a string or an array
33  
34 =head1 SYNOPSIS
35  
36 # {author => "tom jones"}
37 reverse(author)
38 # {author => "senoj mot"}
39  
40 # {numbers => [1,14,2]}
41 reverse(numbers)
42 # {numbers => [2,14,1]}
43  
44 =head1 SEE ALSO
45  
46 L<Catmandu::Fix>
47  
48 =cut
« blib/lib/Catmandu/Fix/hash.pm ↑ Summary blib/lib/Catmandu/Fix/upcase.pm »