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

filter: Statementstmt 92.5% 37 / 40 Branchbran 50.0% 4 / 8 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 80.3% 53 / 66 CC 8 SCAR 13.4
CC
8
Cov
81%
__ANON__
8.3
__ANON__
2.1
__ANON__
2.1
CRAP 3.8
« blib/lib/Bot/Cobalt/Common.pm ↑ Summary blib/lib/Bot/Cobalt/Logger/Output.pm »
1 package Bot::Cobalt::Conf::File::Core;
2 2 $Bot::Cobalt::Conf::File::Core::VERSION = '0.021003';
3 2 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Bot::Cobalt::Common ':types';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 extends 'Bot::Cobalt::Conf::File';
12  
13 has language => (
14 lazy => 1,
15 is => 'rwp',
16 isa => Str,
17 2 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=7.2
18 2 my ($self) = @_;
19 2 ▶ $self->cfg_as_hash->{Language} // 'english' ;
Condition50%1/2
$self->cfg_as_hash->{"Language"} // "english"
l!l
20
MC/DC0%0/1
$self->cfg_as_hash->{"Language"} // "english"
$self->cfg_as_hash->{"Language"}
Truth table50%1/2
A
A= $self->cfg_as_hash->{"Language"}
Aresult
11
00
20 },
21 2 );
22  
23 has paths => (
24 lazy => 1,
25 weak_ref => 1,
26 is => 'rwp',
27 isa => HashRef,
28 1 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=7.2
29 1 my ($self) = @_;
30 ref $self->cfg_as_hash->{Paths} eq 'HASH' ?
31 $self->cfg_as_hash->{Paths}
32 : {}
33 1 ▶ },
Branch: 1 branch
BranchTrueFalseTotal
ref $self->cfg_as_hash->{'Paths'} eq 'HASH' ? : 0 1 1
34 2 );
35  
36 has irc => (
37 lazy => 1,
38 weak_ref => 1,
39 is => 'rwp',
40 isa => HashRef,
41 1 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
42 1 my ($self) = @_;
43 $self->cfg_as_hash->{IRC}
44 1 },
45 2 );
46  
47 has opts => (
48 lazy => 1,
49 weak_ref => 1,
50 is => 'rwp',
51 isa => HashRef,
52 2 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
53 2 my ($self) = @_;
54 $self->cfg_as_hash->{Opts}
55 2 },
56 2 );
57  
58 2 ▶around 'validate' => sub {
Subroutine __ANON__: called CC=6 SCAR=21.2
59 2 my ($orig, $self, $cfg) = @_;
60  
61 2 my $path = $self->cfg_path;
62  
63 2 for my $expected_hash (qw/ IRC Opts /) {
64 4 ▶ unless (defined $cfg->{$expected_hash}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $cfg->{$expected_hash}) 0 4 4
65 0 die "Directive '$expected_hash' not found; should be a hash\n"
66 }
67  
68 4 ▶ unless (ref $cfg->{$expected_hash} eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $cfg->{$expected_hash} eq "HASH") 0 4 4
69 0 die "Directive '$expected_hash' should be a hash\n"
70 }
71
72 4 ▶ if (defined $cfg->{Paths} && ref $cfg->{Paths} ne 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $cfg->{"Paths"} and ref $cfg->{"Paths"} ne "HASH") 0 4 4
Condition33%1/3
defined $cfg->{"Paths"} and ref $cfg->{"Paths"} ne "HASH"
!ll&&!rl&&r
400
MC/DC0%0/2
defined $cfg->{"Paths"} and ref $cfg->{"Paths"} ne "HASH"
defined $cfg->{"Paths"} ref $cfg->{"Paths"} ne "HASH"
Truth table33%1/3
A and B
A= defined $cfg->{"Paths"}B= ref $cfg->{"Paths"} ne "HASH"
ABresult
0X0
100
111
73 0 die "Directive 'Paths' specified but not a hash\n"
74 }
75 }
76  
77 1
78 2 };
79  
80  
81 2 1;
82 __END__
« blib/lib/Bot/Cobalt/Common.pm ↑ Summary blib/lib/Bot/Cobalt/Logger/Output.pm »