Mercurial > pub > Impl
annotate Lib/IMPL/Config/Container.pm @ 170:b88b7fe60aa3
refactoring
author | sourcer |
---|---|
date | Tue, 24 May 2011 01:11:16 +0400 |
parents | 76515373dac0 |
children | a705e848dcc7 |
rev | line source |
---|---|
49 | 1 package IMPL::Config::Container; |
2 use strict; | |
3 use warnings; | |
4 | |
165 | 5 use parent qw(IMPL::Config); |
49 | 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; |