Mercurial > pub > Impl
comparison Lib/IMPL/Config/Container.pm @ 0:03e58a454b20
Создан репозитарий
author | Sergey |
---|---|
date | Tue, 14 Jul 2009 12:54:37 +0400 |
parents | |
children | 16ada169ca75 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:03e58a454b20 |
---|---|
1 package IMPL::Config::Container; | |
2 use strict; | |
3 use warnings; | |
4 | |
5 use base qw(IMPL::Config); | |
6 use IMPL::Class::Property; | |
7 | |
8 BEGIN { | |
9 public property Chidren => prop_all; | |
10 } | |
11 | |
12 sub CTOR { | |
13 my ($this,%args) = @_; | |
14 | |
15 $this->Chidren(\%args); | |
16 } | |
17 | |
18 sub save { | |
19 my ($this,$ctx) = @_; | |
20 | |
21 while (my ($key,$value) = each %{$this->Chidren}) { | |
22 $ctx->AddVar($key,$value); | |
23 } | |
24 } | |
25 | |
26 our $AUTOLOAD; | |
27 sub AUTOLOAD { | |
28 my $this = shift; | |
29 | |
30 (my $prop = $AUTOLOAD) =~ s/.*?(\w+)$/$1/; | |
31 | |
32 my $child = $this->Chidren->{$prop}; | |
33 if (ref $child and $child->isa('IMPL::Config::Class')) { | |
34 return $child->instance(@_); | |
35 } else { | |
36 return $child; | |
37 } | |
38 } | |
39 | |
40 1; |