view 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
line wrap: on
line source

package IMPL::Config::Link;

use strict;

require IMPL::Exception;

require Tie::Scalar;
our @ISA = qw(Tie::StdScalar);

sub FETCH {
	return ${$_[0]} = ${$_[0]}->instance() if UNIVERSAL::isa(${$_[0]},'IMPL::Config::Activator');
}

sub surrogate {
	die new IMPL::Exception("You can't create a forward declarations of the link");
}

sub restore {
	my ($self,$data,$surrogate) = @_;

	my %args = @$data;
	
	die new IMPL::Exception('A target is required for the link') unless exists $args{target};
	my $val;
	tie $val, $self, $args{target};
	return $val;
}