ASP/ConfigLoader.pm

filter: Statementstmt 92.5% 25 / 27 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 91.8% 34 / 37 CC 2 SCAR 2.6
CC
2
Cov
90%
load
2.2
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« ASP/Mock/ClientSocket.pm ↑ Summary ASP/Test/Base.pm »
1  
2 package Apache2::ASP::ConfigLoader;
3  
4 24 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 24 ▶use warnings 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 24 ▶use Carp 'confess';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 24 ▶use Apache2::ASP::ConfigFinder;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 24 ▶use Apache2::ASP::ConfigParser;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 24 ▶use XML::Simple ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 24 $XML::Simple::PREFERRED_PARSER = 'XML::Parser';
11  
12 24 our $Configs = { };
13  
14  
15 #==============================================================================
16 sub load
17 {
18 6 ▶ my ($s) = @_;
Subroutine load: called CC=2 SCAR=7.9
Pod documented
19
20 6 my $path = Apache2::ASP::ConfigFinder->config_path;
21 6 ▶ return $Configs->{$path} if $Configs->{$path};
Branch: 1 branch
BranchTrueFalseTotal
if $Apache2::ASP::ConfigLoader::Configs->{$path} 0 6 6
22
23 6 my $doc = XML::Simple::XMLin( $path,
24 SuppressEmpty => '',
25 ForceArray => [qw/ var setting location /],
26 KeyAttr => { },
27 );
28
29 0 (my $where = $path) =~ s/\/conf\/[^\/]+$//;
30 0 return $Configs->{$path} = Apache2::ASP::ConfigParser->new->parse( $doc, $where );
31 }# end parse()
32  
33 24 1;# return true:
34  
35 __END__
« ASP/Mock/ClientSocket.pm ↑ Summary ASP/Test/Base.pm »