| 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
Condition0%0/3
$file and -f $file
MC/DC0%0/2
$file and -f $file
$file
-f $file
Truth table0%0/3
A and B
A= $fileB= -f $file
| |||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||