Mercurial > pub > Impl
diff 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 |
line wrap: on
line diff
--- a/Lib/IMPL/Object/List.pm Fri Mar 12 16:23:46 2010 +0300 +++ b/Lib/IMPL/Object/List.pm Mon Mar 15 02:38:09 2010 +0300 @@ -68,5 +68,24 @@ return $this; } +sub save { + my ($this,$ctx) = @_; + + $ctx->AddVar( item => $_ ) foreach @$this; +} + +sub restore { + my ($class,$data,$surrogate) = @_; + + my $i = 0; + + if ($surrogate) { + @$surrogate = grep { ($i++)%2 } @$data; + } else { + $surrogate = $class->new([grep { ($i++)%2 } @$data]); + } + + return $surrogate; +} 1;