ASP/ConfigNode.pm

filter: Statementstmt 32.2% 10 / 31 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 2 totaltotal 28.2% 13 / 46 CC 5 SCAR 22.0
CC
5
Cov
27%
init_keys
20.0
AUTOLOAD
6.0
new
2.0
CRAP 9.0
« ASP/Response.pm ↑ Summary ASP/Config.pm »
1  
2 package Apache2::ASP::ConfigNode;
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  
8  
9 #==============================================================================
10 sub new
11 {
12 0 ▶ my ($class, $ref) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
13 0 local $SIG{__DIE__} = \&Carp::confess;
14 0 my $s = bless $ref, $class;
15 0 $s->init_keys();
16 0 $s;
17 }# end new()
18  
19  
20 #==============================================================================
21 sub init_keys
22 {
23 0 ▶ my $s = shift;
Subroutine init_keys: not called CC=4 SCAR=30.0
Pod undocumented
24
25 0 foreach my $key ( grep { ref($s->{$_}) eq 'HASH' } keys(%$s) )
26 {
27 0 ▶ if( $key eq 'web' )
Branch: 2 branches
BranchTrueFalseTotal
if ($key eq 'web') { } 0 0 0
elsif ($key eq 'system') { } 0 0 0
28 {
29 0 require Apache2::ASP::ConfigNode::Web;
30 0 $s->{$key} = Apache2::ASP::ConfigNode::Web->new( $s->{$key} );
31 }
32 elsif( $key eq 'system' )
33 {
34 0 require Apache2::ASP::ConfigNode::System;
35 0 $s->{$key} = Apache2::ASP::ConfigNode::System->new( $s->{$key} );
36 }
37 else
38 {
39 0 $s->{$key} = __PACKAGE__->new( $s->{$key} );
40 }# end if()
41 }# end foreach()
42 }# end init_keys()
43  
44  
45 #==============================================================================
46 sub AUTOLOAD
47 {
48 0 ▶ my $s = shift;
Subroutine AUTOLOAD: not called CC=2 SCAR=17.9
49 0 our $AUTOLOAD;
50 0 my ($name) = $AUTOLOAD =~ m/([^:]+)$/;
51
52 0 ▶ confess "Unknown method or property '$name'" unless exists($s->{$name});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $s->{$name} 0 0 0
53
54 # Read-only:
55 0 $s->{$name};
56 }# end AUTOLOAD()
57  
58  
59 #==============================================================================
60 sub DESTROY
61 {
62 0 ▶ my $s = shift;
Subroutine DESTROY: not called CC=1 SCAR=6.9
63 0 undef(%$s);
64 }# end DESTROY()
65  
66 24 1;# return true:
67  
68 __END__
« ASP/Response.pm ↑ Summary ASP/Config.pm »