NAME
Util::DataThing::Serializer - Abstract base class for objects that can serialize and deserialize Util::DataThing objects to various formats
SYNOPSIS
my $serializer = Util::DataThing::Serializer::SomeSubclass->new();
$serializer->serialize_object_to_stream($object, $fh);
METHODS
$string = $serializer->serialize_object_to_string($object)
Serializes the given Util::DataThing object to a string and returns that string.
$object = $serializer->deserialize_object_from_string($string, $class)
Attempts to deserialize the given string to an object of the given class, which must be a subclass of Util::DataThing.
$serializer->serialize_object_to_stream($object, $stream)
Serializes the given Util::DataThing object to a string and writes the result to the given stream.
The stream must be some kind of IO object.
$object = $serializer->deserialize_object_from_stream($stream, $class)
Attempts to deserialize data read from the given stream to an object of the given class, which must be a subclass of Util::DataThing.
The stream must be some kind of L<IO> object.
INFORMATION FOR SUBCLASS IMPLEMENTORS
If you are developing a subclass of this class, you must provide implementations for the serialize and deserialize functions based on strings.
Default implementations of the stream-based methods are provided which are simple wrappers around the string-based methods. Subclasses should override these if they are able to do something more sensible.