AnyEvent::Serialize(3pm)

AnyEvent::Serialize3pm

Async serialize/deserialize function

Usage

  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) = @_ }

Overview

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.

Export

serialize($object, $result_callback)

Serializes Your object. When serialization is done it will call $result_callback. This callback receives two arguments:

result string
flag if recursion is detected

deserialize($str, $result_callback)

Deserializes Your string. When deserialization is done or an error is detected it will call $result_callback. This callback receives three arguments:

deserialized object
error string (if an error was occured)
undeserialized string tail

Breaking

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.

Releases

7 releases since Debian 7 (Wheezy); the text changed 2 times.

  1. 7–10
  2. 11
  3. 12–13

Author

Dmitry E. Oboukhov, <[email protected]>

From libanyevent-serialize-perl 0.04-1.2 in Debian 13 (Trixie). Parsed by carta from the page's man source.