| 1 | package DBIx::Class::Schema::Diff::Filter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Further filters diff data produced by DBIx::Class::Schema::Diff | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | with 'DBIx::Class::Schema::Diff::Role::Common'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Types::Standard qw(:all); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 86 | ▶ | has 'mode', is => 'ro', isa => Enum[qw(limit ignore)], default => sub{'limit'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | has 'match', is => 'ro', isa => Maybe[InstanceOf['Hash::Layout']], default => sub{undef}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | has 'events', is => 'ro', coerce => \&_coerce_list_hash, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | isa => Maybe[Map[Enum[qw(added changed deleted)],Bool]]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | has 'source_events', is => 'ro', coerce => \&_coerce_list_hash, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | isa => Maybe[Map[Enum[qw(added changed deleted)],Bool]]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | has 'empty_match', is => 'ro', lazy => 1, default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 86 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 86 | ▶ | return (scalar(keys %{$self->match->Data}) > 0) ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 4 | }, init_arg => undef, isa => Bool; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 105 | ▶ | has 'matched_paths', is => 'ro', init_arg => undef, default => sub {[]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | sub filter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 105 | ▶ | my ($self, $diff) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
filter: called CC=11 SCAR=24.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 105 | ▶ | return undef unless ($diff); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 105 | my $newd = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 105 | for my $s_name (keys %$diff) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 606 | my $h = $diff->{$s_name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | next if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | $self->skip_source($s_name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | || $self->_is_skip( source_events => $h->{_event}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 606 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->skip_source($s_name) or $self->_is_skip("source_events", $h->{"_event"})
MC/DC100%2/2
$self->skip_source($s_name) or $self->_is_skip("source_events", $h->{"_event"})
$self->skip_source($s_name)
$self->_is_skip("source_events", $h->{"_event"})
Truth table100%3/3
A or B
A= $self->skip_source($s_name)B= $self->_is_skip("source_events", $h->{"_event"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 442 | $newd->{$s_name} = $self->source_filter( $s_name => $h ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 442 | ▶ | delete $newd->{$s_name} unless (defined $newd->{$s_name}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # Strip if the event is 'changed' but the diff data has been stripped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | delete $newd->{$s_name} if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | $newd->{$s_name} && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | $newd->{$s_name}{_event} && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | $newd->{$s_name}{_event} eq 'changed' && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 442 | ▶ | scalar(keys %{$newd->{$s_name}}) == 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
$newd->{$s_name} and $newd->{$s_name}{"_event"} and $newd->{$s_name}{"_event"} eq "changed" and scalar keys %{$$newd{$s_name};} == 1
$newd->{$s_name} and $newd->{$s_name}{"_event"} and $newd->{$s_name}{"_event"} eq "changed"
$newd->{$s_name} and $newd->{$s_name}{"_event"}
MC/DC50%2/4
$newd->{$s_name} and $newd->{$s_name}{"_event"} and $newd->{$s_name}{"_event"} eq "changed" and scalar keys %{$$newd{$s_name};} == 1
$newd->{$s_name}
$newd->{$s_name}{"_event"}
$newd->{$s_name}{"_event"} eq "changed"
scalar keys %{$$newd{$s_name};} == 1
Truth table60%3/5
A and B and C and D
A= $newd->{$s_name}B= $newd->{$s_name}{"_event"}C= $newd->{$s_name}{"_event"} eq "changed"D= scalar keys %{$$newd{$s_name};} == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 105 | ▶ | return scalar(keys %$newd) > 0 ? $newd : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | sub source_filter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 442 | ▶ | my ($self, $s_name, $diff) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
source_filter: called CC=10 SCAR=23.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 442 | ▶ | return undef unless ($diff); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 442 | my $newd = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 442 | for my $type (keys %$diff) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 1023 | ▶ | next if ($type ne '_event' && $self->skip_type($s_name => $type)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$type ne "_event" and $self->skip_type($s_name, $type)
MC/DC100%2/2
$type ne "_event" and $self->skip_type($s_name, $type)
$type ne "_event"
$self->skip_type($s_name, $type)
Truth table100%3/3
A and B
A= $type ne "_event"B= $self->skip_type($s_name, $type)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 855 | my $val = $diff->{$type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 855 | ▶ | if($type eq 'columns' || $type eq 'relationships' || $type eq 'constraints') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$type eq "columns" or $type eq "relationships" or $type eq "constraints"
$type eq "columns" or $type eq "relationships"
MC/DC100%3/3
$type eq "columns" or $type eq "relationships" or $type eq "constraints"
$type eq "columns"
$type eq "relationships"
$type eq "constraints"
Truth table100%4/4
A or B or C
A= $type eq "columns"B= $type eq "relationships"C= $type eq "constraints"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 280 | $newd->{$type} = $self->_info_filter( $type, $s_name => $val ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 280 | ▶ | delete $newd->{$type} unless (defined $newd->{$type}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 575 | $newd->{$type} = $val | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 442 | ▶ | return (scalar(keys %$newd) > 0) ? $newd : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | sub _info_filter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 280 | ▶ | my ($self, $type, $s_name, $items) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_info_filter: called CC=10 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 280 | ▶ | return undef unless ($items); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 280 | my $new_items = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 280 | for my $name (keys %$items) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | next if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | $self->_is_skip( 'events' => $items->{$name}{_event}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 474 | ▶ | || $self->skip_type_id($s_name, $type => $name ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->_is_skip("events", $items->{$name}{"_event"}) or $self->skip_type_id($s_name, $type, $name)
MC/DC100%2/2
$self->_is_skip("events", $items->{$name}{"_event"}) or $self->skip_type_id($s_name, $type, $name)
$self->_is_skip("events", $items->{$name}{"_event"})
$self->skip_type_id($s_name, $type, $name)
Truth table100%3/3
A or B
A= $self->_is_skip("events", $items->{$name}{"_event"})B= $self->skip_type_id($s_name, $type, $name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 381 | ▶ | if($items->{$name}{_event} eq 'changed') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 195 | my $check = $self->test_path($s_name, $type, $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 195 | ▶ | if($check && ref($check) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$check and ref $check eq "HASH"
MC/DC100%2/2
$check and ref $check eq "HASH"
$check
ref $check eq "HASH"
Truth table100%3/3
A and B
A= $checkB= ref $check eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | my $new_diff = $self->_deep_value_filter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 47 | ▶ | $items->{$name}{diff}, $s_name, $type, $name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | ) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 24 | $new_items->{$name} = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | _event => 'changed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | diff => $new_diff | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | # Allow through as-is: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 148 | $new_items->{$name} = $items->{$name};# if ($check); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # Allow through as-is: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 186 | $new_items->{$name} = $items->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | #if($self->match->lookup_leaf_path($s_name, $type, $name)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 280 | ▶ | return scalar(keys %$new_items) > 0 ? $new_items : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | sub _deep_value_filter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 59 | ▶ | my ($self, $hash, @path) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_deep_value_filter: called CC=11 SCAR=24.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 59 | my $new_hash = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 59 | for my $k (keys %$hash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 59 | my $val = $hash->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 59 | my $set = $self->test_path(@path,$k); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 59 | ▶ | if($set) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 37 | ▶ | if($val && ref($val) eq 'HASH' && ref($set) eq 'HASH' && scalar(keys %$val) > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$val and ref $val eq "HASH" and ref $set eq "HASH" and scalar keys %$val > 0
$val and ref $val eq "HASH" and ref $set eq "HASH"
$val and ref $val eq "HASH"
MC/DC50%2/4
$val and ref $val eq "HASH" and ref $set eq "HASH" and scalar keys %$val > 0
$val
ref $val eq "HASH"
ref $set eq "HASH"
scalar keys %$val > 0
Truth table60%3/5
A and B and C and D
A= $valB= ref $val eq "HASH"C= ref $set eq "HASH"D= scalar keys %$val > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 12 | $new_hash->{$k} = $self->_deep_value_filter($val,@path,$k); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 12 | ▶ | delete $new_hash->{$k} unless (defined $new_hash->{$k}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 25 | ▶ | next if ($self->mode eq 'ignore'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 24 | $new_hash->{$k} = $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 22 | ▶ | next if ($self->mode eq 'limit'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $new_hash->{$k} = $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 59 | ▶ | return scalar(keys %$new_hash) > 0 ? $new_hash : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | sub _is_skip { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 937 | ▶ | my ($self, $meth, $key) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_skip: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 937 | my $h = $self->$meth; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 937 | ▶ | $self->mode eq 'limit' ? $h && ! $h->{$key} : $h && $h->{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$h and not $h->{$key}
$h and $h->{$key}
MC/DC100%2/2
$h and not $h->{$key}
$h
not $h->{$key}
MC/DC100%2/2
$h and $h->{$key}
$h
$h->{$key}
Truth table100%3/3
A and not(B)
A= $hB= not $h->{$key}
Truth table100%3/3
A and B
A= $hB= $h->{$key}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | sub skip_source { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 606 | ▶ | my ($self, $s_name) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
skip_source: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 606 | ▶ | my $HL = $self->match or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 606 | ▶ | my $set = $self->test_path($s_name) || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->test_path($s_name) || 0
MC/DC100%1/1
$self->test_path($s_name) || 0
$self->test_path($s_name)
Truth table100%2/2
A
A= $self->test_path($s_name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 606 | ▶ | if($self->mode eq 'limit') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 489 | ▶ | return 0 if ($self->empty_match); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 449 | ▶ | return $set ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 117 | ▶ | return $set && ! ref($set) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$set and not ref $set
MC/DC100%2/2
$set and not ref $set
$set
not ref $set
Truth table100%3/3
A and not(B)
A= $setB= not ref $set
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | sub skip_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 581 | ▶ | my ($self, $s_name, $type) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
skip_type: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 581 | ▶ | my $HL = $self->match or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 581 | my $set = $self->test_path($s_name,$type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 581 | ▶ | if($self->mode eq 'limit') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 466 | ▶ | return 0 if ($self->empty_match); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | # If this source/type is set, OR if the entire source is included: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 422 | ▶ | return $set || $self->test_leaf_path($s_name) ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$set or $self->test_leaf_path($s_name)
MC/DC100%2/2
$set or $self->test_leaf_path($s_name)
$set
$self->test_leaf_path($s_name)
Truth table100%3/3
A or B
A= $setB= $self->test_leaf_path($s_name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 115 | ▶ | return $set && ! ref($set) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$set and not ref $set
MC/DC100%2/2
$set and not ref $set
$set
not ref $set
Truth table100%3/3
A and not(B)
A= $setB= not ref $set
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | sub skip_type_id { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 468 | ▶ | my ($self, $s_name, $type, $id) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
skip_type_id: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 468 | ▶ | my $HL = $self->match or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 468 | my $set = $self->test_path($s_name,$type,$id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 468 | ▶ | if($self->mode eq 'limit') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 364 | ▶ | return 0 if ($self->empty_match); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # If this source/type is set, OR if the entire source or source/type is included: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 312 | ▶ | return $set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$set or $self->test_leaf_path($s_name) or $self->test_leaf_path($s_name, $type)
$set or $self->test_leaf_path($s_name)
MC/DC100%3/3
$set or $self->test_leaf_path($s_name) or $self->test_leaf_path($s_name, $type)
$set
$self->test_leaf_path($s_name)
$self->test_leaf_path($s_name, $type)
Truth table100%4/4
A or B or C
A= $setB= $self->test_leaf_path($s_name)C= $self->test_leaf_path($s_name, $type)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | || $self->test_leaf_path($s_name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | || $self->test_leaf_path($s_name,$type) ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 104 | ▶ | return $set && ! ref($set) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$set and not ref $set
MC/DC100%2/2
$set and not ref $set
$set
not ref $set
Truth table100%3/3
A and not(B)
A= $setB= not ref $set
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | sub test_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 1909 | ▶ | my ($self, @path) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
test_path: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 1909 | ▶ | return $self->test_leaf_path(@path) || $self->match->lookup_path(@path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$self->test_leaf_path(@path) || $self->match->lookup_path(@path)
MC/DC100%2/2
$self->test_leaf_path(@path) || $self->match->lookup_path(@path)
$self->test_leaf_path(@path)
$self->match->lookup_path(@path)
Truth table100%3/3
A || B
A= $self->test_leaf_path(@path)B= $self->match->lookup_path(@path)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | sub test_leaf_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 2515 | ▶ | my ($self, @path) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
test_leaf_path: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 2515 | my $ret = $self->match->lookup_leaf_path(@path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 2515 | ▶ | push @{$self->matched_paths}, \@path if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$ret and not ref $ret
MC/DC50%1/2
$ret and not ref $ret
$ret
not ref $ret
Truth table66%2/3
A and not(B)
A= $retB= not ref $ret
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | $ret | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # We don't want to record the path as "matched" for empty HashRef {} leafs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | && ! ref $ret | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 2515 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||