Mercurial > pub > Impl
comparison Lib/IMPL/Object/List.pm @ 63:76b878ad6596
Added serialization support for the IMPL::Object::List
More intelligent Exception message
Fixed encoding support in the actions
Improoved tests
Minor fixes
author | wizard |
---|---|
date | Mon, 15 Mar 2010 02:38:09 +0300 |
parents | 16ada169ca75 |
children | e36ffd8c29db |
comparison
equal
deleted
inserted
replaced
62:c64bd1bf727d | 63:76b878ad6596 |
---|---|
66 @$this = grep $_ ne $item, @$this; | 66 @$this = grep $_ ne $item, @$this; |
67 | 67 |
68 return $this; | 68 return $this; |
69 } | 69 } |
70 | 70 |
71 sub save { | |
72 my ($this,$ctx) = @_; | |
73 | |
74 $ctx->AddVar( item => $_ ) foreach @$this; | |
75 } | |
76 | |
77 sub restore { | |
78 my ($class,$data,$surrogate) = @_; | |
79 | |
80 my $i = 0; | |
81 | |
82 if ($surrogate) { | |
83 @$surrogate = grep { ($i++)%2 } @$data; | |
84 } else { | |
85 $surrogate = $class->new([grep { ($i++)%2 } @$data]); | |
86 } | |
87 | |
88 return $surrogate; | |
89 } | |
71 | 90 |
72 1; | 91 1; |