| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Data::ModeMerge::Mode::SUBTRACT; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2016-07-22'; # DATE |
|
4
|
|
|
|
|
|
|
our $VERSION = '0.35'; # VERSION |
|
5
|
|
|
|
|
|
|
|
|
6
|
31
|
|
|
31
|
|
462
|
use 5.010; |
|
|
31
|
|
|
|
|
119
|
|
|
7
|
31
|
|
|
31
|
|
267
|
use strict; |
|
|
31
|
|
|
|
|
76
|
|
|
|
31
|
|
|
|
|
636
|
|
|
8
|
31
|
|
|
31
|
|
106
|
use warnings; |
|
|
31
|
|
|
|
|
34
|
|
|
|
31
|
|
|
|
|
745
|
|
|
9
|
31
|
|
|
31
|
|
96
|
use Mo qw(build default); |
|
|
31
|
|
|
|
|
27
|
|
|
|
31
|
|
|
|
|
112
|
|
|
10
|
|
|
|
|
|
|
extends 'Data::ModeMerge::Mode::NORMAL'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
732
|
|
|
732
|
1
|
1294
|
sub name { 'SUBTRACT' } |
|
13
|
|
|
|
|
|
|
|
|
14
|
8726
|
|
|
8726
|
1
|
10903
|
sub precedence_level { 4 } |
|
15
|
|
|
|
|
|
|
|
|
16
|
330
|
|
|
330
|
1
|
762
|
sub default_prefix { '-' } |
|
17
|
|
|
|
|
|
|
|
|
18
|
330
|
|
|
330
|
1
|
981
|
sub default_prefix_re { qr/^-/ } |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub merge_SCALAR_SCALAR { |
|
21
|
42
|
|
|
42
|
0
|
67
|
my ($self, $key, $l, $r) = @_; |
|
22
|
42
|
|
|
|
|
151
|
($key, $l - $r); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub merge_SCALAR_ARRAY { |
|
26
|
1
|
|
|
1
|
0
|
2
|
my ($self, $key, $l, $r) = @_; |
|
27
|
1
|
|
|
|
|
2
|
$self->merger->push_error("Can't subtract scalar and array"); |
|
28
|
1
|
|
|
|
|
2
|
return; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub merge_SCALAR_HASH { |
|
32
|
1
|
|
|
1
|
0
|
2
|
my ($self, $key, $l, $r) = @_; |
|
33
|
1
|
|
|
|
|
3
|
$self->merger->push_error("Can't subtract scalar and hash"); |
|
34
|
1
|
|
|
|
|
2
|
return; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub merge_ARRAY_SCALAR { |
|
38
|
1
|
|
|
1
|
0
|
1
|
my ($self, $key, $l, $r) = @_; |
|
39
|
1
|
|
|
|
|
3
|
$self->merger->push_error("Can't subtract array and scalar"); |
|
40
|
1
|
|
|
|
|
2
|
return; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub merge_ARRAY_ARRAY { |
|
44
|
4
|
|
|
4
|
0
|
7
|
my ($self, $key, $l, $r) = @_; |
|
45
|
4
|
|
|
|
|
6
|
my @res; |
|
46
|
4
|
|
|
|
|
10
|
my $mm = $self->merger; |
|
47
|
4
|
|
|
|
|
19
|
for (@$l) { |
|
48
|
12
|
100
|
|
|
|
58
|
push @res, $_ unless $mm->_in($_, $r); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
4
|
|
|
|
|
20
|
($key, \@res); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub merge_ARRAY_HASH { |
|
54
|
2
|
|
|
2
|
0
|
4
|
my ($self, $key, $l, $r) = @_; |
|
55
|
2
|
|
|
|
|
3
|
$self->merger->push_error("Can't subtract array and hash"); |
|
56
|
2
|
|
|
|
|
3
|
return; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub merge_HASH_SCALAR { |
|
60
|
1
|
|
|
1
|
0
|
2
|
my ($self, $key, $l, $r) = @_; |
|
61
|
1
|
|
|
|
|
2
|
$self->merger->push_error("Can't subtract hash and scalar"); |
|
62
|
1
|
|
|
|
|
2
|
return; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub merge_HASH_ARRAY { |
|
66
|
2
|
|
|
2
|
0
|
3
|
my ($self, $key, $l, $r) = @_; |
|
67
|
2
|
|
|
|
|
5
|
$self->merger->push_error("Can't subtract hash and array"); |
|
68
|
2
|
|
|
|
|
3
|
return; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub merge_HASH_HASH { |
|
72
|
3
|
|
|
3
|
0
|
6
|
my ($self, $key, $l, $r) = @_; |
|
73
|
3
|
|
|
|
|
10
|
my $mm = $self->merger; |
|
74
|
|
|
|
|
|
|
|
|
75
|
3
|
|
|
|
|
9
|
my %res; |
|
76
|
3
|
|
|
|
|
5
|
my $r2 = {}; |
|
77
|
3
|
|
|
|
|
15
|
for (keys %$r) { |
|
78
|
5
|
100
|
|
|
|
13
|
my $k = $mm->check_prefix($_) ? $_ : $mm->add_prefix($_, 'DELETE'); |
|
79
|
5
|
50
|
66
|
|
|
38
|
if ($k ne $_ && exists($r->{$k})) { |
|
80
|
0
|
|
|
|
|
0
|
$mm->push_error("Conflict when adding DELETE prefix on right-side hash key $_ ". |
|
81
|
|
|
|
|
|
|
"for SUBTRACT merge: key $k already exists"); |
|
82
|
0
|
|
|
|
|
0
|
return; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
5
|
|
|
|
|
10
|
$r2->{$k} = $r->{$_}; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
3
|
|
|
|
|
17
|
$mm->_merge($key, $l, $r2, 'NORMAL'); |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
|
90
|
|
|
|
|
|
|
# ABSTRACT: Handler for Data::ModeMerge SUBTRACT merge mode |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=pod |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=encoding UTF-8 |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 NAME |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Data::ModeMerge::Mode::SUBTRACT - Handler for Data::ModeMerge SUBTRACT merge mode |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 VERSION |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This document describes version 0.35 of Data::ModeMerge::Mode::SUBTRACT (from Perl distribution Data-ModeMerge), released on 2016-07-22. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
use Data::ModeMerge; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This is the class to handle SUBTRACT merge mode. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=for Pod::Coverage ^merge_.* |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 HOMEPAGE |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Data-ModeMerge>. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 SOURCE |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Data-ModeMerge>. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 BUGS |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-ModeMerge> |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
|
129
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
|
130
|
|
|
|
|
|
|
feature. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 AUTHOR |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This software is copyright (c) 2016 by perlancar@cpan.org. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
141
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |