| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 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 | |||||||||||||||