RabbitFoot/Cmd/Role/Config.pm

filter: Statementstmt 78.9% 15 / 19 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 59.3% 19 / 32 CC 3 SCAR 17.4
CC
3
Cov
62%
get_config_from_file
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.7
« RabbitFoot/Cmd/Role/Command.pm ↑ Summary RabbitFoot/Cmd/Command/bind_queue.pm »
1 package Net::RabbitFoot::Cmd::Role::Config;
2  
3 1 ▶use FindBin;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Config::Any;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 with qw(MooseX::ConfigFromFile);
8  
9 1 has configfile => (
10 isa => 'Str',
11 is => 'rw',
12 default => $FindBin::Bin . '/config.json',
13 metaclass => 'MooseX::Getopt::Meta::Attribute',
14 cmd_aliases => 'c',
15 documentation => 'config file',
16 );
17  
18 1 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 0 ▶sub get_config_from_file {
Subroutine get_config_from_file: not called CC=3 SCAR=24.8
Pod undocumented
21 0 my ($self, $file,) = @_;
22  
23 0 ▶ return {} if !$file || !-f $file;
Branch: 1 branch
BranchTrueFalseTotal
unless $file and -f $file 0 0 0
Condition0%0/3
$file and -f $file
!ll&&!rl&&r
000
MC/DC0%0/2
$file and -f $file
$file -f $file
Truth table0%0/3
A and B
A= $fileB= -f $file
ABresult
0X0
100
111
24  
25 0 my $config = Config::Any->load_files({
26 files => [$file],
27 use_ext => 1,
28 driver_args => {General => {-LowerCaseNames => 1}}
29 });
30  
31 0 return $config->[0]->{$file} or die "Could not load $file";
32 }
33  
34 1 1;
35  
« RabbitFoot/Cmd/Role/Command.pm ↑ Summary RabbitFoot/Cmd/Command/bind_queue.pm »