Infrastructure/Config.pm

filter: Statementstmt 50.0% 12 / 24 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 100% 3 / 3 totaltotal 47.3% 18 / 38 CC 3 SCAR 12.4
CC
3
Cov
43%
get_node
6.0
get
6.0
__ANON__
2.0
CRAP 3.4
« Infrastructure/Exec.pm ↑ Summary Infrastructure/Filesystem.pm »
1 package Test::BDD::Infrastructure::Config;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use MooseX::Singleton;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '1.005'; # VERSION
7 # ABSTRACT: configuration variables support for Test::BDD::Infrastructure
8  
9 1 ▶use Test::BDD::Infrastructure::Config::YAML;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 has '_configs' => (
13 is => 'ro', isa => 'HashRef', lazy => 1,
14 0 ▶ default => sub { {} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
15 1 traits => [ 'Hash' ],
16 handles => {
17 register_config => 'set',
18 unregister_config => 'delete',
19 clear_all_configs => 'clear',
20 },
21 );
22  
23  
24 0 ▶sub load_config {
Subroutine load_config: not called CC=1 SCAR=6.9
Pod documented
25 0 my ( $self, $file ) = @_;
26 0 $self->register_config(
27 'c' => Test::BDD::Infrastructure::Config::YAML->new(
28 file => $file,
29 )
30 );
31 0 return;
32 }
33  
34  
35 0 ▶sub get_node {
Subroutine get_node: not called CC=2 SCAR=17.9
Pod documented
36 0 my ( $self, $scope, $path ) = @_;
37 0 ▶ if( ! defined $self->_configs->{$scope} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->_configs->{$scope}) 0 0 0
38 0 die('no configuration loaded for "'.$scope.'"');
39 }
40 0 return $self->_configs->{$scope}->get_node( $path );
41 }
42  
43  
44 0 ▶sub get {
Subroutine get: not called CC=2 SCAR=17.9
Pod documented
45 0 my ( $self, $scope, $path ) = @_;
46 0 ▶ if( ! defined $self->_configs->{$scope} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->_configs->{$scope}) 0 0 0
47 0 die('no configuration loaded for "'.$scope.'"');
48 }
49 0 return $self->_configs->{$scope}->get( $path );
50 }
51  
52  
53 1 1;
54  
55 __END__
« Infrastructure/Exec.pm ↑ Summary Infrastructure/Filesystem.pm »