blib/lib/Catmandu/Fix/prepend.pm

filter: Statementstmt 100% 20 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 96.1% 25 / 26 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/parse_text.pm ↑ Summary blib/lib/Catmandu/Fix/replace_all.pm »
1 package Catmandu::Fix::prepend;
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 1 has value => (fix_arg => 1);
13  
14 1 with 'Catmandu::Fix::SimpleGetValue';
15  
16 sub emit_value {
17 2 ▶ my ($self, $var, $fixer) = @_;
Subroutine emit_value: called CC=1 SCAR=0.0
Pod undocumented
18 2 my $value = $fixer->emit_string($self->value);
19 2 "${var} = join('', ${value}, ${var}) if is_value(${var});";
20 }
21  
22 1 1;
23  
24 __END__
25  
26 =pod
27  
28 =head1 NAME
29  
30 Catmandu::Fix::prepend - add a prefix to the value of a field
31  
32 =head1 SYNOPSIS
33  
34 # prepend to a value. e.g. {name => 'smith'}
35 prepend(name, 'mr. ') # {name => 'mr. smith'}
36  
37 =head1 SEE ALSO
38  
39 L<Catmandu::Fix>
40  
41 =cut
« blib/lib/Catmandu/Fix/parse_text.pm ↑ Summary blib/lib/Catmandu/Fix/replace_all.pm »