Async serialize/deserialize function
use AnyEvent::Serialize ':all'; use AnyEvent::Serialize 'serialize'; use AnyEvent::Serialize 'deserialize'; use AnyEvent::Serialize ... block_size => 666; serialize $object, sub { ($str, $recursion_detected) = @_ }; deserialize $string, sub { my ($object, $error, $tail) = @_ }
Sometimes You need to serialize/deserialize a lot of data. If You do it using Data::Dumper or eval it can take You too much time. This module splits (de)serialization process into fixed-size parts and does this work in non-blocking mode.
This module uses Data::StreamSerializer and Data::StreamDeserializer to serialize or deserialize Your data.
Serializes Your object. When serialization is done it will call $result_callback. This callback receives two arguments:
Deserializes Your string. When deserialization is done or an error is detected it will call $result_callback. This callback receives three arguments:
You can break serialization/deserialization process if You save value that is returned by functions serialize/deserialize. They return guards if they are called in non-void context.
Data::StreamSerializer, Data::StreamDeserializer.
Dmitry E. Oboukhov, <[email protected]>
Copyright (C) 2011 by Dmitry E. Oboukhov
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.