Simple/YAML.pm

filter: Statementstmt 79.1% 19 / 24 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 78.3% 29 / 37 CC 4 SCAR 12.5
CC
4
Cov
73%
config_file
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.5
« Simple/JSON.pm ↑ Summary Simple.pm »
1 package Config::Files::Simple::YAML;
2  
3 =encoding UTF-8
4
5 =head1 NAME
6
7 Config::Files::Simple::YAML - Yet another config file reader.
8  
9 =head1 VERSION
10  
11 version 0.03
12  
13 =cut
14  
15 2 our $VERSION = '0.03'; # VERSION
16  
17 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 =head1 SUBROUTINES/METHODS
22  
23 =head2 new
24  
25 Constructor
26  
27 =cut
28  
29 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
30 2 my $class = shift;
31 2 my $self = {};
32 2 bless $self, $class;
33 }
34  
35 =head2 config_file
36  
37 Read configuration file from given path.
38  
39 =cut
40  
41 2 ▶sub config_file {
Subroutine config_file: called CC=4 SCAR=17.9
Pod documented
42 2 ▶ if ( !-f $_[1] ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f $_[1]) 0 2 2
43 0 require Carp;
44 0 Carp::cluck "could not find $_[1] file";
45 0 return undef;
46 }
47 2 require String::Any::Extensions;
48 2 ▶ if ( !String::Any::Extensions::include( $_[1], defined $_[2] ? $_[2] : [ '.yml', '.yaml' ] ) ) {
Branch: 2 branches
BranchTrueFalseTotal
unless (String::Any::Extensions::include($_[1], defined $_[2] ? $_[2] : [".yml", ".yaml"])) 0 2 2
defined $_[2] ? : 0 2 2
49 0 require Carp;
50 0 Carp::cluck("$_[1] seems not to be a YAML file.");
51 }
52 2 require YAML;
53 2 return YAML::LoadFile( $_[1] );
54 }
55  
56 2 1;
57  
58 __END__
« Simple/JSON.pm ↑ Summary Simple.pm »