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

filter: Statementstmt 96.6% 29 / 30 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.0% 9 / 10 Podpod 0.0% 0 / 1 totaltotal 88.8% 40 / 45 SCAR 11.0
CC
3
Cov
91%
readfile
3.1
__ANON__
2.0
BEGIN
1.0
CRAP 3.0
« blib/lib/Bot/Cobalt/Conf/File.pm ↑ Summary blib/lib/Bot/Cobalt/Error.pm »
1 package Bot::Cobalt::Conf::Role::Reader;
2 2 $Bot::Cobalt::Conf::Role::Reader::VERSION = '0.021002';
3 2 ▶use Carp;
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 Try::Tiny;
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 2 ▶use Bot::Cobalt::Serializer;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶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 4 ▶ builder => sub { Bot::Cobalt::Serializer->new },
Subroutine _build__serializer: called CC=1 SCAR=0.0
17 2 );
18  
19 sub readfile {
20 4 ▶ my ($self, $path) = @_;
Subroutine readfile: called CC=3 SCAR=11.4
Pod undocumented
21  
22 4 ▶ confess "readfile() needs a path to read"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $path 0 4 4
23 unless defined $path;
24  
25 4 my $err;
26 my $thawed_cf = try {
27 4 ▶ $self->_serializer->readfile( $path )
Subroutine __ANON__: called CC=1 SCAR=0.0
28 } catch {
29 0 ▶ $err = $_
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 4 };
31  
32 4 ▶ confess "Serializer readfile() failed for $path; $err"
Branch: 1 branch
BranchTrueFalseTotal
if defined $err 0 4 4
33 if defined $err;
34  
35 4 $thawed_cf
36 }
37  
38  
39 2 1;
40 __END__
« blib/lib/Bot/Cobalt/Conf/File.pm ↑ Summary blib/lib/Bot/Cobalt/Error.pm »