annotate Lib/IMPL/Object/PublicSerializable.pm @ 393:69a1f1508696

minor security refactoring
author cin
date Fri, 14 Feb 2014 16:41:12 +0400
parents 8088779e539d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
278
4ddb27ff4a0b core refactoring
cin
parents: 194
diff changeset
4 use IMPL::Const qw(:access);
60
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
18 my ($this,$ctx) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
19
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
20 my %seen;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
21
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
22 my $val;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
23
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
24 defined($val = $this->$_()) and $ctx->AddVar($_,$val) foreach
278
4ddb27ff4a0b core refactoring
cin
parents: 194
diff changeset
25 map $_->name,$this->GetMeta(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
26 'IMPL::Class::PropertyInfo',
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
27 sub {
278
4ddb27ff4a0b core refactoring
cin
parents: 194
diff changeset
28 $_->access == ACCESS_PUBLIC and
4ddb27ff4a0b core refactoring
cin
parents: 194
diff changeset
29 $_->getter and
294
8088779e539d corrected IMPL::Config::Activator
cin
parents: 278
diff changeset
30 $_->setter and
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
31 not $_->ownerSet and
278
4ddb27ff4a0b core refactoring
cin
parents: 194
diff changeset
32 not $seen{$_->name} ++
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
33 },
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
34 1
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
35 );
60
b0c068da93ac Lazy activation for the configuration objects (final concept)
wizard
parents:
diff changeset
36 }
b0c068da93ac Lazy activation for the configuration objects (final concept)
wizard
parents:
diff changeset
37
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 61
diff changeset
38 1;