blib/lib/Bot/Cobalt/Conf/File/Channels.pm

filter: Statementstmt 85.7% 18 / 21 Branchbran 33.3% 2 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 100% 1 / 1 totaltotal 76.4% 26 / 34 SCAR 16.9
CC
5
Cov
74%
context
6.0
__ANON__
4.1
BEGIN
1.0
CRAP 5.4
« blib/lib/Bot/Cobalt/Plugin/Games/Magic8.pm ↑ Summary blib/lib/Bot/Cobalt.pm »
1 package Bot::Cobalt::Conf::File::Channels;
2 $Bot::Cobalt::Conf::File::Channels::VERSION = '0.021002';
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 Bot::Cobalt::Common ':types';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 extends 'Bot::Cobalt::Conf::File';
11  
12  
13 sub context {
14 0 ▶ my ($self, $context) = @_;
Subroutine context: not called CC=2 SCAR=17.9
Pod documented
15 0 ▶ croak "context() requires a server context identifier"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $context 0 0 0
16 unless defined $context;
17  
18 0 $self->cfg_as_hash->{$context}
19 }
20  
21  
22 around 'validate' => sub {
23 1 ▶ my ($orig, $self, $cfg) = @_;
Subroutine __ANON__: called CC=4 SCAR=14.2
24  
25 1 my @contexts = keys %$cfg;
26 1 ▶ die "There are no contexts defined.\n" unless @contexts;
Branch: 1 branch
BranchTrueFalseTotal
unless @contexts 0 1 1
27
28 1 for my $context (@contexts) {
29 die "Context directive $context is not a hash"
30 1 ▶ unless ref $cfg->{$context} eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $cfg->{$context} eq "HASH" 0 1 1
31 }
32  
33 1
34 1 };
35  
36  
37 1;
38 __END__
« blib/lib/Bot/Cobalt/Plugin/Games/Magic8.pm ↑ Summary blib/lib/Bot/Cobalt.pm »