blib/lib/Bot/Cobalt/Core/ContextMeta/Ignore.pm

filter: Statementstmt 50.0% 15 / 30 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 62.5% 5 / 8 Podpod 100% 2 / 2 totaltotal 33.8% 22 / 65 CC 9 SCAR 26.5
CC
9
Cov
31%
__ANON__
30.0
reason
12.0
addedby
12.0
CRAP 14.2
« blib/lib/Bot/Cobalt/Serializer.pm ↑ Summary blib/lib/Bot/Cobalt/Plugin/RDB/AsyncSearch.pm »
1 package Bot::Cobalt::Core::ContextMeta::Ignore;
2 $Bot::Cobalt::Core::ContextMeta::Ignore::VERSION = '0.021003';
3 2 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use IRC::Utils 'normalize_mask';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Bot::Cobalt::Common ':types';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 extends 'Bot::Cobalt::Core::ContextMeta';
12  
13  
14 0 ▶around add => sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
15 0 my $orig = shift;
16 0 my ($self, $context, $mask, $reason, $addedby) = @_;
17
18 0 my ($pkg, $line) = (caller)[0,2];
19
20 0 ▶ confess "Missing arguments in ignore add()"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $context and defined $mask 0 0 0
Condition0%0/3
defined $context and defined $mask
!ll&&!rl&&r
000
MC/DC0%0/2
defined $context and defined $mask
defined $context defined $mask
Truth table0%0/3
A and B
A= defined $contextB= defined $mask
ABresult
0X0
100
111
21 unless defined $context and defined $mask;
22
23 0 $mask = normalize_mask($mask);
24 0 ▶ $addedby = $pkg unless defined $addedby;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $addedby 0 0 0
25 0 ▶ $reason = "Added by $pkg" unless defined $reason;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $reason 0 0 0
26  
27 0 my $meta = +{
28 AddedBy => $addedby,
29 Reason => $reason,
30 };
31  
32 0 $self->$orig($context, $mask, $meta)
33 };
34  
35 0 ▶sub reason {
Subroutine reason: not called CC=3 SCAR=24.8
Pod documented
36 0 my ($self, $context, $mask) = @_;
37
38 return unless exists $self->_list->{$context}
39 0 ▶ and exists $self->_list->{$context}->{$mask};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->_list->{$context} and exists $self->_list->{$context}{$mask} 0 0 0
Condition0%0/3
exists $self->_list->{$context} and exists $self->_list->{$context}{$mask}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->_list->{$context} and exists $self->_list->{$context}{$mask}
exists $self->_list->{$context} exists $self->_list->{$context}{$mask}
Truth table0%0/3
A and B
A= exists $self->_list->{$context}B= exists $self->_list->{$context}{$mask}
ABresult
0X0
100
111
40  
41 $self->_list->{$context}->{$mask}->{Reason}
42 0 }
43  
44 0 ▶sub addedby {
Subroutine addedby: not called CC=3 SCAR=24.8
Pod documented
45 0 my ($self, $context, $mask) = @_;
46  
47 return unless exists $self->_list->{$context}
48 0 ▶ and exists $self->_list->{$context}->{$mask};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->_list->{$context} and exists $self->_list->{$context}{$mask} 0 0 0
Condition0%0/3
exists $self->_list->{$context} and exists $self->_list->{$context}{$mask}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->_list->{$context} and exists $self->_list->{$context}{$mask}
exists $self->_list->{$context} exists $self->_list->{$context}{$mask}
Truth table0%0/3
A and B
A= exists $self->_list->{$context}B= exists $self->_list->{$context}{$mask}
ABresult
0X0
100
111
49
50 $self->_list->{$context}->{$mask}->{AddedBy}
51 0 }
52  
53 1;
54 __END__
« blib/lib/Bot/Cobalt/Serializer.pm ↑ Summary blib/lib/Bot/Cobalt/Plugin/RDB/AsyncSearch.pm »