Mercurial > pub > Impl
annotate Lib/IMPL/Config/Container.pm @ 141:7245c39e941e
(no commit message)
author | wizard |
---|---|
date | Tue, 06 Jul 2010 17:26:48 +0400 |
parents | 0f3e369553bd |
children | 76515373dac0 |
rev | line source |
---|---|
49 | 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}; | |
59
0f3e369553bd
Rewritten property implementation (probably become slower but more flexible)
wizard
parents:
49
diff
changeset
|
33 if (UNIVERSAL::isa($child,'IMPL::Config::Class')) { |
49 | 34 return $child->instance(@_); |
35 } else { | |
36 return $child; | |
37 } | |
38 } | |
39 | |
40 1; |