comparison Lib/IMPL/Object/PublicSerializable.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
children 8d0ae27d15c1
comparison
equal deleted inserted replaced
59:0f3e369553bd 60:b0c068da93ac
1 package IMPL::Object::PublicSerializable;
2 use strict;
3
4 use IMPL::Class::Member;
5
6 sub restore {
7 my ($class,$data,$refSurrogate) = @_;
8
9 if ($refSurrogate) {
10 $refSurrogate->callCTOR(@$data);
11 return $refSurrogate;
12 } else {
13 return $class->new(@$data);
14 }
15 }
16
17 sub save {
18 my ($this,$ctx) = @_;
19
20 my %seen;
21
22 $ctx->AddVar($_,$this->$_()) foreach
23 map $_->Name,$this->get_meta(
24 'IMPL::Class::PropertyInfo',
25 sub {
26 $_->Access == IMPL::Class::Member::MOD_PUBLIC and
27 $_->canGet and
28 not $_->ownerSet and
29 not $seen{$_->Name} ++
30 },
31 1
32 );
33 }
34
35 1;