Connector/Proxy/YAML.pm

filter: Statementstmt 85.0% 34 / 40 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 88.8% 8 / 9 Podpod 100% 1 / 1 totaltotal 77.9% 46 / 59 CC 4 SCAR 8.9
CC
4
Cov
79%
_build_config
5.0
set
2.0
BEGIN
1.0
CRAP 2.4
« Connector/Iterator.pm ↑ Summary Connector/Proxy.pm »
1 # Connector::Proxy::YAML
2 #
3 # Proxy class for reading YAML configuration
4 #
5 # Written by Scott Hardin and Martin Bartosch for the OpenXPKI project 2012
6 #
7 package Connector::Proxy::YAML;
8  
9 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use English;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use YAML;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 3 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 3 extends 'Connector::Builtin::Memory';
18  
19 # set Location required (unset by parent class)
20 3 has '+LOCATION' => ( required => 1 );
21  
22 3 ▶sub _build_config {
Subroutine _build_config: called CC=4 SCAR=16.1
23 3 my $self = shift;
24  
25 # File not exist or not readable
26 3 my $config;
27 3 my $file = $self->LOCATION();
28 3 ▶ if ( ( -e $file ) && ( -r $file ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $file and -r $file) { } 3 0 3
Condition33%1/3
-e $file and -r $file
!ll&&!rl&&r
003
MC/DC0%0/2
-e $file and -r $file
-e $file -r $file
Truth table33%1/3
A and B
A= -e $fileB= -r $file
ABresult
0X0
100
111
29 3 eval {
30 3 $config = YAML::LoadFile( $file );
31 };
32 3 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 3 3
33 0 $self->log()->error('Proxy::Yaml error parsing file '.$file);
34 0 $self->log()->debug( Dumper( $@ ) );
35 0 return $self->_node_not_exists( $file );
36 }
37 3 $self->log()->debug('Proxy::Yaml loading configuration from file '.$file);
38 } else {
39 0 $self->log()->warn('Proxy::Yaml configuration file '.$file.' not found or not readable');
40 }
41 3 $self->_config($config);
42 }
43  
44 0 ▶sub set { shift; die "No set() method defined"; };
Subroutine set: not called CC=1 SCAR=6.9
Pod documented
45  
46 3 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
47 3 __PACKAGE__->meta->make_immutable;
48  
49 3 1;
50 __END__
« Connector/Iterator.pm ↑ Summary Connector/Proxy.pm »