line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
19
|
|
|
19
|
|
91812
|
|
|
19
|
|
|
|
|
40
|
|
|
19
|
|
|
|
|
132
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
19
|
|
|
19
|
|
119
|
use Catmandu::Util::Path qw(as_path); |
|
19
|
|
|
|
|
37
|
|
|
19
|
|
|
|
|
102
|
|
8
|
19
|
|
|
19
|
|
7759
|
use namespace::clean; |
|
19
|
|
|
|
|
40
|
|
|
19
|
|
|
|
|
1027
|
|
9
|
19
|
|
|
19
|
|
133
|
use Catmandu::Fix::Has; |
|
19
|
|
|
|
|
43
|
|
|
19
|
|
|
|
|
139
|
|
10
|
19
|
|
|
19
|
|
10820
|
|
|
19
|
|
|
|
|
53
|
|
|
19
|
|
|
|
|
126
|
|
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
|
|
887
|
} |
19
|
105
|
|
|
|
|
474
|
|
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 |