view Lib/IMPL/Config/Container.pm @ 198:2ffe6f661605

Implemented IMPL::Web::Handler::RestController fixes in IMPL::Serialization completed IMPL::Web::Application::RestResource added IMPL::Web::Handler::JSONView added IMPL::Web::RestContract
author cin
date Fri, 20 Apr 2012 16:06:36 +0400
parents a705e848dcc7
children
line wrap: on
line source

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

use parent qw(IMPL::Config);
use IMPL::Class::Property;
use Carp qw(carp);

BEGIN {
	carp "the module is deprecated";
	
    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;