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

filter: Statementstmt 83.3% 40 / 48 Branchbran 42.8% 6 / 14 Conditioncond 33.3% 4 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 100% 11 / 11 Podpod 100% 4 / 4 totaltotal 67.0% 65 / 97 CC 12 SCAR 14.5
CC
12
Cov
68%
get_irc_obj
8.1
get_irc_casemap
5.3
is_connected
4.1
CRAP 4.3
« blib/lib/Bot/Cobalt/Plugin/Extras/Debug.pm ↑ Summary blib/lib/Bot/Cobalt/Lang.pm »
1 package Bot::Cobalt::Core::Role::IRC;
2 1 $Bot::Cobalt::Core::Role::IRC::VERSION = '0.021003';
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 1 ▶ default => sub { +{} },
Subroutine __ANON__: called CC=1 SCAR=0.0
20 1 );
21  
22  
23 1 ▶sub is_connected {
Subroutine is_connected: called CC=3 SCAR=14.2
Pod documented
24 1 my ($self, $context) = @_;
25 1 ▶ return unless $context and exists $self->Servers->{$context};
Branch: 1 branch
BranchTrueFalseTotal
unless $context and exists $self->Servers->{$context} 1 0 1
Condition33%1/3
$context and exists $self->Servers->{$context}
!ll&&!rl&&r
010
MC/DC0%0/2
$context and exists $self->Servers->{$context}
$context exists $self->Servers->{$context}
Truth table33%1/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 3 ▶sub get_irc_context {
Subroutine get_irc_context: called CC=3 SCAR=14.2
Pod documented
31 3 my ($self, $context) = @_;
32 3 ▶ return unless defined $context and exists $self->Servers->{$context};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $context and exists $self->Servers->{$context} 3 0 3
Condition33%1/3
defined $context and exists $self->Servers->{$context}
!ll&&!rl&&r
030
MC/DC0%0/2
defined $context and exists $self->Servers->{$context}
defined $context exists $self->Servers->{$context}
Truth table33%1/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 1 ▶sub get_irc_obj {
Subroutine get_irc_obj: called CC=5 SCAR=20.9
Pod documented
38 1 my ($self, $context) = @_;
39 1 ▶ if (! $context) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($context) 0 1 1
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 1 my $c_obj = $self->get_irc_context($context);
48 1 ▶ unless ($c_obj && blessed $c_obj) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($c_obj and builtin::blessed($c_obj)) 1 0 1
Condition33%1/3
$c_obj and builtin::blessed($c_obj)
!ll&&!rl&&r
100
MC/DC0%0/2
$c_obj and builtin::blessed($c_obj)
$c_obj builtin::blessed($c_obj)
Truth table33%1/3
A and B
A= $c_objB= builtin::blessed($c_obj)
ABresult
0X0
100
111
49 1 $self->log->warn(
50 "get_irc_obj called but context $context not found at "
51 .join ' ', (caller)[0,2]
52 );
53 return
54 1 }
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 1 ▶sub get_irc_casemap {
Subroutine get_irc_casemap: called CC=4 SCAR=16.8
Pod documented
60 1 my ($self, $context) = @_;
61 1 ▶ if (! $context) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($context) 0 1 1
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 1 my $c_obj = $self->get_irc_context($context);
70 1 ▶ unless ($c_obj && blessed $c_obj) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($c_obj and builtin::blessed($c_obj)) 1 0 1
Condition33%1/3
$c_obj and builtin::blessed($c_obj)
!ll&&!rl&&r
100
MC/DC0%0/2
$c_obj and builtin::blessed($c_obj)
$c_obj builtin::blessed($c_obj)
Truth table33%1/3
A and B
A= $c_objB= builtin::blessed($c_obj)
ABresult
0X0
100
111
71 1 $self->log->warn(
72 "get_irc_casemap called but context $context not found at "
73 .join ' ', (caller)[0,2]
74 );
75 return
76 1 }
77  
78 $c_obj->casemap
79 0 }
80  
81  
82 1 1;
83 __END__
« blib/lib/Bot/Cobalt/Plugin/Extras/Debug.pm ↑ Summary blib/lib/Bot/Cobalt/Lang.pm »