Mercurial > pub > Impl
annotate Lib/IMPL/Config/Container.pm @ 165:76515373dac0
Added Class::Template,
Rewritten SQL::Schema
'use parent' directive instead of 'use base'
author | wizard |
---|---|
date | Sat, 23 Apr 2011 23:06:48 +0400 |
parents | 0f3e369553bd |
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; |