Mercurial > pub > Impl
annotate 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 |
rev | line source |
---|---|
60
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
1 package IMPL::Object::PublicSerializable; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
2 use strict; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
3 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
4 use IMPL::Class::Member; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
5 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
6 sub restore { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
7 my ($class,$data,$refSurrogate) = @_; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
8 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
9 if ($refSurrogate) { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
10 $refSurrogate->callCTOR(@$data); |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
11 return $refSurrogate; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
12 } else { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
13 return $class->new(@$data); |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
14 } |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
15 } |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
16 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
17 sub save { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
18 my ($this,$ctx) = @_; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
19 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
20 my %seen; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
21 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
22 $ctx->AddVar($_,$this->$_()) foreach |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
23 map $_->Name,$this->get_meta( |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
24 'IMPL::Class::PropertyInfo', |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
25 sub { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
26 $_->Access == IMPL::Class::Member::MOD_PUBLIC and |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
27 $_->canGet and |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
28 not $_->ownerSet and |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
29 not $seen{$_->Name} ++ |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
30 }, |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
31 1 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
32 ); |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
33 } |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
34 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
35 1; |