view Lib/IMPL/Config/Link.pm @ 58:a35b60b16a99

Configuration, late activation
author wizard
date Fri, 05 Mar 2010 20:14:45 +0300
parents
children 0f3e369553bd
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 restore {
	my ($self,$data,$surrogate) = @_;
	
	my %args = @$data;
	
	die new IMPL::Exception('A target is required for the link') unless exists $args{target};
	
	return $self->new($args{target});
}