Mercurial > pub > Impl
comparison 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 |
comparison
equal
deleted
inserted
replaced
59:0f3e369553bd | 60:b0c068da93ac |
---|---|
218 Name => $name, | 218 Name => $name, |
219 Type => $rhProps->{'type'} || 'SCALAR', | 219 Type => $rhProps->{'type'} || 'SCALAR', |
220 Id => $rhProps->{'id'}, | 220 Id => $rhProps->{'id'}, |
221 refId => $rhProps->{'refid'} | 221 refId => $rhProps->{'refid'} |
222 }; | 222 }; |
223 $this->{$Context}->{$rhProps->{'id'}} = $this->{$SurogateHelper} ? $this->{$SurogateHelper}->($rhProps->{'type'}) : DefaultSurogateHelper($rhProps->{'type'}) if defined $rhProps->{'id'}; | 223 |
224 if (defined $rhProps->{'id'}) { | |
225 die new IMPL::Exception("Trying to create a simple object instead of a reference, type is missing.",$name,$rhProps->{id}) unless $rhProps->{'type'} ; | |
226 $this->{$Context}->{$rhProps->{'id'}} = $this->{$SurogateHelper} ? $this->{$SurogateHelper}->($rhProps->{'type'}) : DefaultSurogateHelper($rhProps->{'type'}); | |
227 } | |
224 } | 228 } |
225 | 229 |
226 return 1; | 230 return 1; |
227 } | 231 } |
228 | 232 |
304 return \$var; | 308 return \$var; |
305 } elsif ($Type eq 'ARRAY') { | 309 } elsif ($Type eq 'ARRAY') { |
306 return []; | 310 return []; |
307 } elsif ($Type eq 'HASH') { | 311 } elsif ($Type eq 'HASH') { |
308 return {}; | 312 return {}; |
309 } else { | 313 } elsif ($Type) { |
310 eval "require $Type" unless _is_class($Type); | 314 eval "require $Type" unless _is_class($Type); |
311 if ($Type->UNIVERSAL::can('surrogate')) { | 315 if (UNIVERSAL::can($Type,'surrogate')) { |
312 return $Type->surrogate(); | 316 return $Type->surrogate(); |
313 } else { | 317 } else { |
314 return bless {}, $Type; | 318 return bless {}, $Type; |
315 } | 319 } |
316 } | 320 } |