line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
19
|
|
|
19
|
|
1528386
|
|
|
19
|
|
|
|
|
1063
|
|
|
19
|
|
|
|
|
1054
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
19
|
|
|
19
|
|
136
|
use Catmandu::Util::Path qw(as_path); |
|
19
|
|
|
|
|
35
|
|
|
19
|
|
|
|
|
1265
|
|
8
|
19
|
|
|
19
|
|
15863
|
use namespace::clean; |
|
19
|
|
|
|
|
42
|
|
|
19
|
|
|
|
|
879
|
|
9
|
19
|
|
|
19
|
|
111
|
use Catmandu::Fix::Has; |
|
19
|
|
|
|
|
34
|
|
|
19
|
|
|
|
|
60
|
|
10
|
19
|
|
|
19
|
|
10618
|
|
|
19
|
|
|
|
|
51
|
|
|
19
|
|
|
|
|
103
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::Fix::Builder'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
14
|
|
|
|
|
|
|
has value => (fix_arg => 1, default => sub {undef}); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my ($self) = @_; |
17
|
|
|
|
|
|
|
as_path($self->path)->setter($self->value); |
18
|
61
|
|
|
61
|
|
515
|
} |
19
|
61
|
|
|
|
|
223
|
|
20
|
|
|
|
|
|
|
1; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Catmandu::Fix::set_field - add or change the value of a HASH key or ARRAY index |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Contrary to C<add_field>, this will not create the intermediate structures |
32
|
|
|
|
|
|
|
if they are missing. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Change the value of 'foo' to 'bar 123' |
37
|
|
|
|
|
|
|
set_field(foo, 'bar 123') |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Change a deeply nested key |
40
|
|
|
|
|
|
|
set_field(my.deep.nested.key, hi) |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# If the second argument is omitted the field has a null value |
43
|
|
|
|
|
|
|
add_field(foo) |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SEE ALSO |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
L<Catmandu::Fix> |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |