| Apache2-ASP documentation | Contained in the Apache2-ASP distribution. |
Apache2::ASP::ConfigNode - generic configuration element
$Config->errors; # Returns a ConfigNode of ConfigNodes.
All parts of the $Config object are instances of ConfigNode or one of its subclasses.
A ConfigNode is juts a blessed hash with AUTOLOAD behavior that permits read-only behavior.
It's possible that some bugs have found their way into this release.
Use RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=Apache2-ASP to submit bug reports.
Please visit the Apache2::ASP homepage at http://www.devstack.com/ to see examples of Apache2::ASP in action.
John Drago <jdrago_999@yahoo.com>
Copyright 2007 John Drago, All rights reserved.
This software is free software. It may be used and distributed under the same terms as Perl itself.
| Apache2-ASP documentation | Contained in the Apache2-ASP distribution. |
package Apache2::ASP::ConfigNode; use strict; use warnings 'all'; use Carp 'confess'; #============================================================================== sub new { my ($class, $ref) = @_; local $SIG{__DIE__} = \&Carp::confess; my $s = bless $ref, $class; $s->init_keys(); $s; }# end new() #============================================================================== sub init_keys { my $s = shift; foreach my $key ( grep { ref($s->{$_}) eq 'HASH' } keys(%$s) ) { if( $key eq 'web' ) { require Apache2::ASP::ConfigNode::Web; $s->{$key} = Apache2::ASP::ConfigNode::Web->new( $s->{$key} ); } elsif( $key eq 'system' ) { require Apache2::ASP::ConfigNode::System; $s->{$key} = Apache2::ASP::ConfigNode::System->new( $s->{$key} ); } else { $s->{$key} = __PACKAGE__->new( $s->{$key} ); }# end if() }# end foreach() }# end init_keys() #============================================================================== sub AUTOLOAD { my $s = shift; our $AUTOLOAD; my ($name) = $AUTOLOAD =~ m/([^:]+)$/; confess "Unknown method or property '$name'" unless exists($s->{$name}); # Read-only: $s->{$name}; }# end AUTOLOAD() #============================================================================== sub DESTROY { my $s = shift; undef(%$s); }# end DESTROY() 1;# return true: __END__