blib/lib/ASP4/ConfigNode.pm

filter: Statementstmt 93.5% 29 / 31 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 2 totaltotal 86.9% 40 / 46 CC 5 SCAR 8.6
CC
5
Cov
92%
init_keys
4.0
AUTOLOAD
2.0
DESTROY
2.0
CRAP 2.4
« blib/lib/ASP4/API.pm ↑ Summary blib/lib/ASP4/HTTPHandler.pm »
1  
2 package
3 ASP4::ConfigNode;
4  
5 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 15 ▶use warnings 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 15 ▶use Carp 'confess';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 sub new
11 225 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
12 225 my ($class, $ref) = @_;
13 225 local $SIG{__DIE__} = \&Carp::confess;
14 225 my $s = bless $ref, $class;
15 225 $s->init_keys();
16 225 $s;
17 }# end new()
18  
19  
20 sub init_keys
21 225 ▶{
Subroutine init_keys: called CC=4 SCAR=13.9
Pod undocumented
22 225 my $s = shift;
23
24 225 foreach my $key ( grep { ref($s->{$_}) eq 'HASH' } keys(%$s) )
25 {
26 120 ▶ if( $key eq 'web' )
Branch: 2 branches
BranchTrueFalseTotal
if ($key eq 'web') { } 15 105 120
elsif ($key eq 'system') { } 15 90 105
27 {
28 15 require ASP4::ConfigNode::Web;
29 15 $s->{$key} = ASP4::ConfigNode::Web->new( $s->{$key} );
30 }
31 elsif( $key eq 'system' )
32 {
33 15 require ASP4::ConfigNode::System;
34 15 $s->{$key} = ASP4::ConfigNode::System->new( $s->{$key} );
35 }
36 else
37 {
38 90 $s->{$key} = __PACKAGE__->new( $s->{$key} );
39 }# end if()
40 }# end foreach()
41 }# end init_keys()
42  
43  
44 sub AUTOLOAD
45 199807 ▶{
Subroutine AUTOLOAD: called CC=2 SCAR=7.0
46 199807 my $s = shift;
47 199807 our $AUTOLOAD;
48 199807 my ($name) = $AUTOLOAD =~ m/([^:]+)$/;
49
50 199807 ▶ confess "Unknown method or property '$name'" unless exists($s->{$name});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $s->{$name} 0 199807 199807
51
52 # Read-only:
53 199807 $s->{$name};
54 }# end AUTOLOAD()
55  
56  
57 sub DESTROY
58 0 ▶{
Subroutine DESTROY: not called CC=1 SCAR=6.9
59 0 my $s = shift;
60 0 undef(%$s);
61 }# end DESTROY()
62  
63 15 1;# return true:
64  
« blib/lib/ASP4/API.pm ↑ Summary blib/lib/ASP4/HTTPHandler.pm »