| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  |  | 
| 2 |  |  |  |  |  |  | package Email::Blaster::ConfigNode; | 
| 3 |  |  |  |  |  |  |  | 
| 4 | 2 |  |  | 2 |  | 389 | use strict; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 53 |  | 
| 5 | 2 |  |  | 2 |  | 9 | use warnings 'all'; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 55 |  | 
| 6 | 2 |  |  | 2 |  | 22 | use Carp 'confess'; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 407 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | #============================================================================== | 
| 10 |  |  |  |  |  |  | sub new | 
| 11 |  |  |  |  |  |  | { | 
| 12 | 0 |  |  | 0 | 0 |  | my ($class, $ref) = @_; | 
| 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 |  |  | 0 | 0 |  | my $s = shift; | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 0 |  |  |  |  |  | foreach my $key ( grep { ref($s->{$_}) eq 'HASH' } keys(%$s) ) | 
|  | 0 |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | { | 
| 27 | 0 | 0 |  |  |  |  | if( $key eq 'throttled' ) | 
|  |  | 0 |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | { | 
| 29 | 0 |  |  |  |  |  | require Email::Blaster::ConfigNode::Throttled; | 
| 30 | 0 |  |  |  |  |  | $s->{$key} = Email::Blaster::ConfigNode::Throttled->new( delete($s->{$key}) ); | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  | elsif( $key eq 'cluster' ) | 
| 33 |  |  |  |  |  |  | { | 
| 34 | 0 |  |  |  |  |  | require Email::Blaster::ConfigNode::Cluster; | 
| 35 | 0 |  |  |  |  |  | $s->{$key} = Email::Blaster::ConfigNode::Cluster->new( delete($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 |  |  | 0 |  |  | my $s = shift; | 
| 49 | 0 |  |  |  |  |  | our $AUTOLOAD; | 
| 50 | 0 |  |  |  |  |  | my ($name) = $AUTOLOAD =~ m/([^:]+)$/; | 
| 51 |  |  |  |  |  |  |  | 
| 52 | 0 | 0 |  |  |  |  | confess "Unknown method or property '$name'" unless exists($s->{$name}); | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | # Setter/Getter: | 
| 55 | 0 | 0 |  |  |  |  | @_ ? $s->{$name} = shift : $s->{$name}; | 
| 56 |  |  |  |  |  |  | }# end AUTOLOAD() | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | #============================================================================== | 
| 60 |  |  |  |  |  |  | sub DESTROY | 
| 61 |  |  |  |  |  |  | { | 
| 62 | 0 |  |  | 0 |  |  | my $s = shift; | 
| 63 | 0 |  |  |  |  |  | undef(%$s); | 
| 64 |  |  |  |  |  |  | }# end DESTROY() | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | 1;# return true: | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  |  |