diff Lib/IMPL/Serialization.pm @ 60:b0c068da93ac

Lazy activation for the configuration objects (final concept) small fixes
author wizard
date Tue, 09 Mar 2010 19:47:39 +0300
parents 16ada169ca75
children 5edc2ac5231c
line wrap: on
line diff
--- a/Lib/IMPL/Serialization.pm	Tue Mar 09 02:50:45 2010 +0300
+++ b/Lib/IMPL/Serialization.pm	Tue Mar 09 19:47:39 2010 +0300
@@ -220,7 +220,11 @@
                           Id => $rhProps->{'id'},
                           refId => $rhProps->{'refid'}
                           };
-    $this->{$Context}->{$rhProps->{'id'}} = $this->{$SurogateHelper} ? $this->{$SurogateHelper}->($rhProps->{'type'}) : DefaultSurogateHelper($rhProps->{'type'}) if defined $rhProps->{'id'};
+
+	if (defined $rhProps->{'id'}) {                          
+    	die new IMPL::Exception("Trying to create a simple object instead of a reference, type is missing.",$name,$rhProps->{id}) unless $rhProps->{'type'} ;
+    	$this->{$Context}->{$rhProps->{'id'}} = $this->{$SurogateHelper} ? $this->{$SurogateHelper}->($rhProps->{'type'}) : DefaultSurogateHelper($rhProps->{'type'});
+	}
   }
   
   return 1;
@@ -306,9 +310,9 @@
     return [];
   } elsif ($Type eq 'HASH') {
     return {};
-  } else {
+  } elsif ($Type) {
     eval "require $Type" unless _is_class($Type);
-    if ($Type->UNIVERSAL::can('surrogate')) {
+    if (UNIVERSAL::can($Type,'surrogate')) {
       return $Type->surrogate();
     } else {
       return bless {}, $Type;