blib/lib/Bot/Cobalt/Conf/Role/Reader.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.9% 10 / 11 Podpod 0.0% 0 / 1 totaltotal 89.3% 42 / 47 CC 3 SCAR 4.5
CC
3
Cov
91%
readfile
3.1
__ANON__
2.0
BEGIN
1.0
CRAP 1.6
« blib/lib/Bot/Cobalt/Core/Role/Singleton.pm ↑ Summary blib/lib/Bot/Cobalt/IRC/Event/Quit.pm »
1 package Bot::Cobalt::Conf::Role::Reader;
2 5 $Bot::Cobalt::Conf::Role::Reader::VERSION = '0.021003';
3 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 5 ▶use Bot::Cobalt::Common -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use Bot::Cobalt::Serializer;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 5 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 has _serializer => (
14 is => 'ro',
15 isa => InstanceOf['Bot::Cobalt::Serializer'],
16 24 ▶ builder => sub { Bot::Cobalt::Serializer->new },
Subroutine _build__serializer: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
17 5 );
18  
19 9 ▶sub readfile {
Subroutine readfile: called CC=3 SCAR=11.4
Pod undocumented
20 9 my ($self, $path) = @_;
21  
22 9 ▶ confess "readfile() needs a path to read"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $path 0 9 9
23 unless defined $path;
24  
25 9 my $err;
26 9 ▶ my $thawed_cf = try {
Subroutine __ANON__: called CC=1 SCAR=0.0
27 9 $self->_serializer->readfile( $path )
28 0 ▶ } catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 0 $err = $_
30 9 };
31  
32 9 ▶ confess "Serializer readfile() failed for $path; $err"
Branch: 1 branch
BranchTrueFalseTotal
if defined $err 0 9 9
33 if defined $err;
34  
35 9 $thawed_cf
36 }
37  
38  
39 5 1;
40 __END__
« blib/lib/Bot/Cobalt/Core/Role/Singleton.pm ↑ Summary blib/lib/Bot/Cobalt/IRC/Event/Quit.pm »