blib/lib/Bot/Cobalt/Core/Role/IRC.pm

filter: Statementstmt 47.9% 23 / 48 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 54.5% 6 / 11 Podpod 100% 4 / 4 totaltotal 34.0% 33 / 97 CC 12 SCAR 26.5
CC
12
Cov
31%
get_irc_obj
30.0
get_irc_casemap
20.0
is_connected
12.0
CRAP 14.1
« bin/cobalt2 ↑ Summary blib/lib/Bot/Cobalt/Core/ContextMeta/Ignore.pm »
1 package Bot::Cobalt::Core::Role::IRC;
2 1 $Bot::Cobalt::Core::Role::IRC::VERSION = '0.021001';
3 1 ▶use 5.10.1;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Bot::Cobalt::Common ':types';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use Scalar::Util 'blessed';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 requires qw/ log debug /;
14  
15  
16 has 'Servers' => (
17 is => 'rw',
18 isa => HashRef,
19 0 ▶ default => sub { +{} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
20 1 );
21  
22  
23 sub is_connected {
24 0 ▶ my ($self, $context) = @_;
Subroutine is_connected: not called CC=3 SCAR=24.8
Pod documented
25 0 ▶ return unless $context and exists $self->Servers->{$context};
Branch: 1 branch
BranchTrueFalseTotal
unless $context and exists $self->Servers->{$context} 0 0 0
Condition0%0/3
$context and exists $self->Servers->{$context}
!ll&&!rl&&r
000
MC/DC0%0/2
$context and exists $self->Servers->{$context}
$context exists $self->Servers->{$context}
Truth table0%0/3
A and B
A= $contextB= exists $self->Servers->{$context}
ABresult
0X0
100
111
26 0 $self->Servers->{$context}->connected
27 }
28  
29 1 *get_irc_server = *get_irc_context;
30 sub get_irc_context {
31 0 ▶ my ($self, $context) = @_;
Subroutine get_irc_context: not called CC=3 SCAR=24.8
Pod documented
32 0 ▶ return unless defined $context and exists $self->Servers->{$context};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $context and exists $self->Servers->{$context} 0 0 0
Condition0%0/3
defined $context and exists $self->Servers->{$context}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $context and exists $self->Servers->{$context}
defined $context exists $self->Servers->{$context}
Truth table0%0/3
A and B
A= defined $contextB= exists $self->Servers->{$context}
ABresult
0X0
100
111
33 0 $self->Servers->{$context}
34 }
35  
36 1 *get_irc_object = *get_irc_obj;
37 sub get_irc_obj {
38 0 ▶ my ($self, $context) = @_;
Subroutine get_irc_obj: not called CC=5 SCAR=34.0
Pod documented
39 0 ▶ if (! $context) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($context) 0 0 0
40 0 $self->log->warn(
41 "get_irc_obj called with no context at "
42 .join ' ', (caller)[0,2]
43 );
44 return
45 0 }
46  
47 0 my $c_obj = $self->get_irc_context($context);
48 0 ▶ unless ($c_obj && blessed $c_obj) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($c_obj and builtin::blessed($c_obj)) 0 0 0
Condition0%0/3
$c_obj and builtin::blessed($c_obj)
!ll&&!rl&&r
000
MC/DC0%0/2
$c_obj and builtin::blessed($c_obj)
$c_obj builtin::blessed($c_obj)
Truth table0%0/3
A and B
A= $c_objB= builtin::blessed($c_obj)
ABresult
0X0
100
111
49 0 $self->log->warn(
50 "get_irc_obj called but context $context not found at "
51 .join ' ', (caller)[0,2]
52 );
53 return
54 0 }
55
56 0 ▶ blessed $c_obj->irc ? $c_obj->irc : ()
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($c_obj->irc) ? : 0 0 0
57 }
58  
59 sub get_irc_casemap {
60 0 ▶ my ($self, $context) = @_;
Subroutine get_irc_casemap: not called CC=4 SCAR=30.0
Pod documented
61 0 ▶ if (! $context) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($context) 0 0 0
62 0 $self->log->warn(
63 "get_irc_casemap called with no context at "
64 .join ' ', (caller)[0,2]
65 );
66 return
67 0 }
68  
69 0 my $c_obj = $self->get_irc_context($context);
70 0 ▶ unless ($c_obj && blessed $c_obj) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($c_obj and builtin::blessed($c_obj)) 0 0 0
Condition0%0/3
$c_obj and builtin::blessed($c_obj)
!ll&&!rl&&r
000
MC/DC0%0/2
$c_obj and builtin::blessed($c_obj)
$c_obj builtin::blessed($c_obj)
Truth table0%0/3
A and B
A= $c_objB= builtin::blessed($c_obj)
ABresult
0X0
100
111
71 0 $self->log->warn(
72 "get_irc_casemap called but context $context not found at "
73 .join ' ', (caller)[0,2]
74 );
75 return
76 0 }
77  
78 $c_obj->casemap
79 0 }
80  
81  
82 1 1;
83 __END__
« bin/cobalt2 ↑ Summary blib/lib/Bot/Cobalt/Core/ContextMeta/Ignore.pm »