line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
19
|
|
|
19
|
|
1512283
|
|
|
19
|
|
|
|
|
60
|
|
|
19
|
|
|
|
|
1153
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
19
|
|
|
19
|
|
124
|
use Catmandu::Util::Path qw(as_path); |
|
19
|
|
|
|
|
40
|
|
|
19
|
|
|
|
|
1270
|
|
8
|
19
|
|
|
19
|
|
15090
|
use namespace::clean; |
|
19
|
|
|
|
|
38
|
|
|
19
|
|
|
|
|
852
|
|
9
|
19
|
|
|
19
|
|
110
|
use Catmandu::Fix::Has; |
|
19
|
|
|
|
|
31
|
|
|
19
|
|
|
|
|
59
|
|
10
|
19
|
|
|
19
|
|
10312
|
|
|
19
|
|
|
|
|
41
|
|
|
19
|
|
|
|
|
97
|
|
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
|
|
490
|
} |
19
|
61
|
|
|
|
|
285
|
|
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 |