Mercurial > pub > Impl
annotate Lib/IMPL/Config/Container.pm @ 228:431db7034a88
Для синхронизации
author | andrei <andrei@nap21.upri> |
---|---|
date | Thu, 13 Sep 2012 17:55:01 +0400 |
parents | a705e848dcc7 |
children |
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; |
196 | 7 use Carp qw(carp); |
49 | 8 |
9 BEGIN { | |
196 | 10 carp "the module is deprecated"; |
11 | |
49 | 12 public property Chidren => prop_all; |
13 } | |
14 | |
15 sub CTOR { | |
16 my ($this,%args) = @_; | |
17 | |
18 $this->Chidren(\%args); | |
19 } | |
20 | |
21 sub save { | |
22 my ($this,$ctx) = @_; | |
23 | |
24 while (my ($key,$value) = each %{$this->Chidren}) { | |
25 $ctx->AddVar($key,$value); | |
26 } | |
27 } | |
28 | |
29 our $AUTOLOAD; | |
30 sub AUTOLOAD { | |
31 my $this = shift; | |
32 | |
33 (my $prop = $AUTOLOAD) =~ s/.*?(\w+)$/$1/; | |
34 | |
35 my $child = $this->Chidren->{$prop}; | |
59
0f3e369553bd
Rewritten property implementation (probably become slower but more flexible)
wizard
parents:
49
diff
changeset
|
36 if (UNIVERSAL::isa($child,'IMPL::Config::Class')) { |
49 | 37 return $child->instance(@_); |
38 } else { | |
39 return $child; | |
40 } | |
41 } | |
42 | |
43 1; |