view Lib/IMPL/Config/Container.pm @ 61:8d0ae27d15c1

minor changes
author wizard
date Wed, 10 Mar 2010 16:41:46 +0300
parents 0f3e369553bd
children 76515373dac0
line wrap: on
line source

package IMPL::Config::Container;
use strict;
use warnings;

use base qw(IMPL::Config);
use IMPL::Class::Property;

BEGIN {
    public property Chidren => prop_all;
}

sub CTOR {
    my ($this,%args) = @_;
    
    $this->Chidren(\%args);
}

sub save {
    my ($this,$ctx) = @_;
    
    while (my ($key,$value) = each %{$this->Chidren}) {
        $ctx->AddVar($key,$value);
    }
}

our $AUTOLOAD;
sub AUTOLOAD {
    my $this = shift;
    
    (my $prop = $AUTOLOAD) =~ s/.*?(\w+)$/$1/;
    
    my $child = $this->Chidren->{$prop};
    if (UNIVERSAL::isa($child,'IMPL::Config::Class')) {
        return $child->instance(@_);
    } else {
        return $child;
    }
}

1;