| 1 | |||||||||||||||
| 2 | package ASP4::ConfigNode; | ||||||||||||||
| 3 | |||||||||||||||
| 4 | 9 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 9 | ▶ | use warnings 'all'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | 9 | ▶ | use Carp 'confess'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | |||||||||||||||
| 8 | |||||||||||||||
| 9 | sub new | ||||||||||||||
| 10 | { | ||||||||||||||
| 11 | 42 | ▶ | my ($class, $ref) = @_; | ||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||
| 12 | 42 | local $SIG{__DIE__} = \&Carp::confess; | |||||||||||||
| 13 | 42 | my $s = bless $ref, $class; | |||||||||||||
| 14 | 42 | $s->init_keys(); | |||||||||||||
| 15 | 42 | $s; | |||||||||||||
| 16 | }# end new() | ||||||||||||||
| 17 | |||||||||||||||
| 18 | |||||||||||||||
| 19 | sub init_keys | ||||||||||||||
| 20 | { | ||||||||||||||
| 21 | 42 | ▶ | my $s = shift; | ||||||||||||
|
Subroutine
init_keys: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||
| 22 | |||||||||||||||
| 23 | 42 | foreach my $key ( grep { ref($s->{$_}) eq 'HASH' } keys(%$s) ) | |||||||||||||
| 24 | { | ||||||||||||||
| 25 | 24 | ▶ | if( $key eq 'web' ) | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 26 | { | ||||||||||||||
| 27 | 3 | require ASP4::ConfigNode::Web; | |||||||||||||
| 28 | 3 | $s->{$key} = ASP4::ConfigNode::Web->new( $s->{$key} ); | |||||||||||||
| 29 | } | ||||||||||||||
| 30 | elsif( $key eq 'system' ) | ||||||||||||||
| 31 | { | ||||||||||||||
| 32 | 3 | require ASP4::ConfigNode::System; | |||||||||||||
| 33 | 3 | $s->{$key} = ASP4::ConfigNode::System->new( $s->{$key} ); | |||||||||||||
| 34 | } | ||||||||||||||
| 35 | else | ||||||||||||||
| 36 | { | ||||||||||||||
| 37 | 18 | $s->{$key} = __PACKAGE__->new( $s->{$key} ); | |||||||||||||
| 38 | }# end if() | ||||||||||||||
| 39 | }# end foreach() | ||||||||||||||
| 40 | }# end init_keys() | ||||||||||||||
| 41 | |||||||||||||||
| 42 | |||||||||||||||
| 43 | sub AUTOLOAD | ||||||||||||||
| 44 | { | ||||||||||||||
| 45 | 32 | ▶ | my $s = shift; | ||||||||||||
|
Subroutine
AUTOLOAD: called CC=2 SCAR=7.0
| |||||||||||||||
| 46 | 32 | our $AUTOLOAD; | |||||||||||||
| 47 | 32 | my ($name) = $AUTOLOAD =~ m/([^:]+)$/; | |||||||||||||
| 48 | |||||||||||||||
| 49 | 32 | ▶ | confess "Unknown method or property '$name'" unless exists($s->{$name}); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 50 | |||||||||||||||
| 51 | # Read-only: | ||||||||||||||
| 52 | 32 | $s->{$name}; | |||||||||||||
| 53 | }# end AUTOLOAD() | ||||||||||||||
| 54 | |||||||||||||||
| 55 | |||||||||||||||
| 56 | sub DESTROY | ||||||||||||||
| 57 | { | ||||||||||||||
| 58 | 0 | ▶ | my $s = shift; | ||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=6.9
| |||||||||||||||
| 59 | 0 | undef(%$s); | |||||||||||||
| 60 | }# end DESTROY() | ||||||||||||||
| 61 | |||||||||||||||
| 62 | 9 | 1;# return true: | |||||||||||||
| 63 | |||||||||||||||