Mercurial > pub > Impl
annotate Lib/IMPL/Config/Link.pm @ 59:0f3e369553bd
Rewritten property implementation (probably become slower but more flexible)
Configuration infrastructure in progress (in the aspect of the lazy activation)
Initial concept for the code generator
| author | wizard |
|---|---|
| date | Tue, 09 Mar 2010 02:50:45 +0300 |
| parents | a35b60b16a99 |
| children |
| rev | line source |
|---|---|
| 58 | 1 package IMPL::Config::Link; |
| 2 | |
| 3 use strict; | |
| 4 | |
| 5 require IMPL::Exception; | |
| 6 | |
| 7 require Tie::Scalar; | |
| 8 our @ISA = qw(Tie::StdScalar); | |
| 9 | |
| 10 sub FETCH { | |
| 11 return ${$_[0]} = ${$_[0]}->instance() if UNIVERSAL::isa(${$_[0]},'IMPL::Config::Activator'); | |
| 12 } | |
| 13 | |
|
59
0f3e369553bd
Rewritten property implementation (probably become slower but more flexible)
wizard
parents:
58
diff
changeset
|
14 sub surrogate { |
|
0f3e369553bd
Rewritten property implementation (probably become slower but more flexible)
wizard
parents:
58
diff
changeset
|
15 die new IMPL::Exception("You can't create a forward declarations of the link"); |
|
0f3e369553bd
Rewritten property implementation (probably become slower but more flexible)
wizard
parents:
58
diff
changeset
|
16 } |
|
0f3e369553bd
Rewritten property implementation (probably become slower but more flexible)
wizard
parents:
58
diff
changeset
|
17 |
| 58 | 18 sub restore { |
| 19 my ($self,$data,$surrogate) = @_; | |
|
59
0f3e369553bd
Rewritten property implementation (probably become slower but more flexible)
wizard
parents:
58
diff
changeset
|
20 |
| 58 | 21 my %args = @$data; |
| 22 | |
| 23 die new IMPL::Exception('A target is required for the link') unless exists $args{target}; | |
|
59
0f3e369553bd
Rewritten property implementation (probably become slower but more flexible)
wizard
parents:
58
diff
changeset
|
24 my $val; |
|
0f3e369553bd
Rewritten property implementation (probably become slower but more flexible)
wizard
parents:
58
diff
changeset
|
25 tie $val, $self, $args{target}; |
|
0f3e369553bd
Rewritten property implementation (probably become slower but more flexible)
wizard
parents:
58
diff
changeset
|
26 return $val; |
| 58 | 27 } |
