diff 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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Lib/IMPL/Config/Link.pm	Fri Mar 05 20:14:45 2010 +0300
@@ -0,0 +1,22 @@
+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});
+}
\ No newline at end of file