File Coverage

blib/lib/Data/ModeMerge/Mode/DELETE.pm
Criterion Covered Total %
statement 32 32 100.0
branch 4 4 100.0
condition n/a
subroutine 19 19 100.0
pod 4 15 26.6
total 59 70 84.2


line stmt bran cond sub pod time code
1             package Data::ModeMerge::Mode::DELETE;
2              
3             our $DATE = '2021-08-15'; # DATE
4             our $VERSION = '0.360'; # VERSION
5              
6 31     31   483 use 5.010;
  31         94  
7 31     31   135 use strict;
  31         47  
  31         591  
8 31     31   150 use warnings;
  31         49  
  31         1072  
9 31     31   181 use Mo qw(build default);
  31         53  
  31         151  
10             extends 'Data::ModeMerge::Mode::Base';
11              
12 719     719 1 1422 sub name { 'DELETE' }
13              
14 4980     4980 1 8180 sub precedence_level { 1 }
15              
16 330     330 1 916 sub default_prefix { '!' }
17              
18 330     330 1 1083 sub default_prefix_re { qr/^!/ }
19              
20             # merge_left_only and merge_right_only are a bit different: they are
21             # called with $l only or $r only instead of both, and should return an
22             # extra argument $mode, i.e. ($key, $result, $backup, $is_circular,
23             # $mode)
24             sub merge_left_only {
25 1     1 0 2 my ($self, $key, $l) = @_;
26 1         2 return;
27             }
28              
29             sub merge_right_only {
30 2     2 0 4 my ($self, $key, $r) = @_;
31 2         11 return;
32             }
33              
34             sub merge_SCALAR_SCALAR {
35 44     44 0 113 return;
36             }
37              
38             sub merge_SCALAR_ARRAY {
39 1     1 0 3 return;
40             }
41              
42             sub merge_SCALAR_HASH {
43 1     1 0 3 return;
44             }
45              
46             sub merge_ARRAY_SCALAR {
47 2     2 0 4 return;
48             }
49              
50             sub merge_ARRAY_ARRAY {
51 4     4 0 9 my ($self, $key, $l, $r) = @_;
52 4 100       10 $self->merger->config->allow_destroy_array or
53             $self->merger->push_error("Now allowed to destroy array via DELETE mode");
54 4         44 return;
55             }
56              
57             sub merge_ARRAY_HASH {
58 1     1 0 2 return;
59             }
60              
61             sub merge_HASH_SCALAR {
62 2     2 0 4 return;
63             }
64              
65             sub merge_HASH_ARRAY {
66 1     1 0 2 return;
67             }
68              
69             sub merge_HASH_HASH {
70 4     4 0 10 my ($self, $key, $l, $r) = @_;
71 4 100       10 $self->merger->config->allow_destroy_hash or
72             $self->merger->push_error("Now allowed to destroy hash via DELETE mode");
73 4         37 return;
74             }
75              
76             1;
77             # ABSTRACT: Handler for Data::ModeMerge DELETE merge mode
78              
79             __END__
80              
81             =pod
82              
83             =encoding UTF-8
84              
85             =head1 NAME
86              
87             Data::ModeMerge::Mode::DELETE - Handler for Data::ModeMerge DELETE merge mode
88              
89             =head1 VERSION
90              
91             This document describes version 0.360 of Data::ModeMerge::Mode::DELETE (from Perl distribution Data-ModeMerge), released on 2021-08-15.
92              
93             =head1 SYNOPSIS
94              
95             use Data::ModeMerge;
96              
97             =head1 DESCRIPTION
98              
99             This is the class to handle DELETE merge mode.
100              
101             =for Pod::Coverage ^merge_.*
102              
103             =head1 HOMEPAGE
104              
105             Please visit the project's homepage at L<https://metacpan.org/release/Data-ModeMerge>.
106              
107             =head1 SOURCE
108              
109             Source repository is at L<https://github.com/perlancar/perl-Data-ModeMerge>.
110              
111             =head1 BUGS
112              
113             Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-ModeMerge>
114              
115             When submitting a bug or request, please include a test-file or a
116             patch to an existing test-file that illustrates the bug or desired
117             feature.
118              
119             =head1 AUTHOR
120              
121             perlancar <perlancar@cpan.org>
122              
123             =head1 COPYRIGHT AND LICENSE
124              
125             This software is copyright (c) 2021, 2016, 2015, 2013, 2012, 2011, 2010 by perlancar <perlancar@cpan.org>.
126              
127             This is free software; you can redistribute it and/or modify it under
128             the same terms as the Perl 5 programming language system itself.
129              
130             =cut