line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::ModeMerge::Mode::ADD; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2021-08-15'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.360'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
31
|
|
|
31
|
|
458
|
use 5.010; |
|
31
|
|
|
|
|
91
|
|
7
|
31
|
|
|
31
|
|
138
|
use strict; |
|
31
|
|
|
|
|
63
|
|
|
31
|
|
|
|
|
680
|
|
8
|
31
|
|
|
31
|
|
148
|
use warnings; |
|
31
|
|
|
|
|
56
|
|
|
31
|
|
|
|
|
803
|
|
9
|
31
|
|
|
31
|
|
138
|
use Mo qw(build default); |
|
31
|
|
|
|
|
62
|
|
|
31
|
|
|
|
|
152
|
|
10
|
|
|
|
|
|
|
extends 'Data::ModeMerge::Mode::NORMAL'; |
11
|
|
|
|
|
|
|
|
12
|
796
|
|
|
796
|
1
|
1860
|
sub name { 'ADD' } |
13
|
|
|
|
|
|
|
|
14
|
8077
|
|
|
8077
|
1
|
12037
|
sub precedence_level { 3 } |
15
|
|
|
|
|
|
|
|
16
|
330
|
|
|
330
|
1
|
966
|
sub default_prefix { '+' } |
17
|
|
|
|
|
|
|
|
18
|
330
|
|
|
330
|
1
|
1027
|
sub default_prefix_re { qr/^\+/ } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub merge_SCALAR_SCALAR { |
21
|
50
|
|
|
50
|
0
|
116
|
my ($self, $key, $l, $r) = @_; |
22
|
50
|
|
50
|
|
|
204
|
($key, ( $l // 0 ) + $r); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub merge_SCALAR_ARRAY { |
26
|
2
|
|
|
2
|
0
|
8
|
my ($self, $key, $l, $r) = @_; |
27
|
2
|
|
|
|
|
8
|
$self->merger->push_error("Can't add scalar and array"); |
28
|
2
|
|
|
|
|
7
|
return; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub merge_SCALAR_HASH { |
32
|
2
|
|
|
2
|
0
|
8
|
my ($self, $key, $l, $r) = @_; |
33
|
2
|
|
|
|
|
6
|
$self->merger->push_error("Can't add scalar and hash"); |
34
|
2
|
|
|
|
|
6
|
return; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub merge_ARRAY_SCALAR { |
38
|
2
|
|
|
2
|
0
|
8
|
my ($self, $key, $l, $r) = @_; |
39
|
2
|
|
|
|
|
7
|
$self->merger->push_error("Can't add array and scalar"); |
40
|
2
|
|
|
|
|
7
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub merge_ARRAY_ARRAY { |
44
|
5
|
|
|
5
|
0
|
14
|
my ($self, $key, $l, $r) = @_; |
45
|
5
|
|
|
|
|
32
|
($key, [ @$l, @$r ]); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub merge_ARRAY_HASH { |
49
|
4
|
|
|
4
|
0
|
13
|
my ($self, $key, $l, $r) = @_; |
50
|
4
|
|
|
|
|
11
|
$self->merger->push_error("Can't add array and hash"); |
51
|
4
|
|
|
|
|
11
|
return; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub merge_HASH_SCALAR { |
55
|
2
|
|
|
2
|
0
|
7
|
my ($self, $key, $l, $r) = @_; |
56
|
2
|
|
|
|
|
9
|
$self->merger->push_error("Can't add hash and scalar"); |
57
|
2
|
|
|
|
|
5
|
return; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub merge_HASH_ARRAY { |
61
|
4
|
|
|
4
|
0
|
13
|
my ($self, $key, $l, $r) = @_; |
62
|
4
|
|
|
|
|
10
|
$self->merger->push_error("Can't add hash and array"); |
63
|
4
|
|
|
|
|
13
|
return; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
# ABSTRACT: Handler for Data::ModeMerge ADD merge mode |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__END__ |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=pod |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=encoding UTF-8 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 NAME |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Data::ModeMerge::Mode::ADD - Handler for Data::ModeMerge ADD merge mode |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 VERSION |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This document describes version 0.360 of Data::ModeMerge::Mode::ADD (from Perl distribution Data-ModeMerge), released on 2021-08-15. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 SYNOPSIS |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
use Data::ModeMerge; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 DESCRIPTION |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This is the class to handle ADD merge mode. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=for Pod::Coverage ^merge_.* |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 HOMEPAGE |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Data-ModeMerge>. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 SOURCE |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Data-ModeMerge>. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 BUGS |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-ModeMerge> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
106
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
107
|
|
|
|
|
|
|
feature. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 AUTHOR |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This software is copyright (c) 2021, 2016, 2015, 2013, 2012, 2011, 2010 by perlancar <perlancar@cpan.org>. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
118
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |