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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
58
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
1 package IMPL::Config::Link;
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
2
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
3 use strict;
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
4
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
5 require IMPL::Exception;
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
6
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
7 require Tie::Scalar;
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
8 our @ISA = qw(Tie::StdScalar);
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
9
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
10 sub FETCH {
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
11 return ${$_[0]} = ${$_[0]}->instance() if UNIVERSAL::isa(${$_[0]},'IMPL::Config::Activator');
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
12 }
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
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
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
18 sub restore {
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
19 my ($self,$data,$surrogate) = @_;
59
0f3e369553bd Rewritten property implementation (probably become slower but more flexible)
wizard
parents: 58
diff changeset
20
58
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
21 my %args = @$data;
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
22
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
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
a35b60b16a99 Configuration, late activation
wizard
parents:
diff changeset
27 }