line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
19
|
|
|
19
|
|
92342
|
|
|
19
|
|
|
|
|
37
|
|
|
19
|
|
|
|
|
122
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
19
|
|
|
19
|
|
122
|
use Catmandu::Util::Path qw(as_path); |
|
19
|
|
|
|
|
45
|
|
|
19
|
|
|
|
|
106
|
|
8
|
19
|
|
|
19
|
|
7357
|
use namespace::clean; |
|
19
|
|
|
|
|
42
|
|
|
19
|
|
|
|
|
1007
|
|
9
|
19
|
|
|
19
|
|
119
|
use Catmandu::Fix::Has; |
|
19
|
|
|
|
|
35
|
|
|
19
|
|
|
|
|
119
|
|
10
|
19
|
|
|
19
|
|
10309
|
|
|
19
|
|
|
|
|
40
|
|
|
19
|
|
|
|
|
130
|
|
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)->creator($self->value); |
18
|
105
|
|
|
105
|
|
819
|
} |
19
|
105
|
|
|
|
|
428
|
|
20
|
|
|
|
|
|
|
1; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Catmandu::Fix::add_field - add or change the value of a HASH key or ARRAY index |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Contrary to C<set_field>, this will create the intermediate structures |
32
|
|
|
|
|
|
|
if they are missing. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Add a new field 'foo' with value 2 |
37
|
|
|
|
|
|
|
add_field(foo, 2) |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Change the value of 'foo' to 'bar 123' |
40
|
|
|
|
|
|
|
add_field(foo, 'bar 123') |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Create a deeply nested key |
43
|
|
|
|
|
|
|
add_field(my.deep.nested.key, hi) |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# If the second argument is omitted the field has a null value |
46
|
|
|
|
|
|
|
add_field(foo) |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SEE ALSO |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
L<Catmandu::Fix> |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |