P5EEx-Blue-0.01

P5EEx::Blue::Serializer


NAME

P5EEx::Blue::Serializer - Interface for serialization and deserialization


SYNOPSIS

    use P5EEx::Blue::P5EE;
    $context = P5EEx::Blue::P5EE->context();
    $serializer = $context->service("Serializer");  # or ...
    $serializer = $context->serializer();
    $data = {
        an => 'arbitrary',
        collection => [ 'of', 'data', ],
        of => {
            arbitrary => 'depth',
        },
    };
    $serialized_data = $serializer->serialize($data);
    $data = $serializer->deserialize($serialized_data);
    print $serializer->dump($data), "\n";


DESCRIPTION

A Serializer is a means by which a structure of data of arbitrary depth may be serialized or deserialized.

Serializers may be used for configuration files, data persistence, or transmission of data across a network.

Serializers include the ability to compress, encrypt, and/or MIME the serialized data. (These are all scalar-to-scalar transformations.)


Class Group: Serializer

The following classes might be a part of the Serializer Class Group.


Class: P5EEx::Blue::Serializer

A Serializer serves to serialize and deserialize perl data structures of arbitrary depth. The base class serializes the data as Perl code using Data::Dumper. (This behavior is overridden with customized serialization techniques by the derived subclasses.)

 * Throws: P5EEx::Blue::Exception::Serializer
 * Since:  0.01

Class Design

The class is entirely made up of static (class) methods. However, they are each intended to be called as methods on the instance itself.


Constructor Methods:

new()

The constructor is inherited from P5EEx::Blue::Service.


Public Methods:

serialize()

    * Signature: $serialized_data = $serializer->serialize($data);
    * Param:     $data              ref
    * Return:    $serialized_data   binary
    * Throws:    P5EEx::Blue::Exception::Serializer
    * Since:     0.01
    Sample Usage:
    $context = P5EEx::Blue::P5EE->context();
    $serializer = $context->service("Serializer");  # or ...
    $serializer = $context->serializer();
    $data = {
        an => 'arbitrary',
        collection => [ 'of', 'data', ],
        of => {
            arbitrary => 'depth',
        },
    };
    $serialized_data = $serializer->serialize($data);

deserialize()

    * Signature: $serialized_data = $serializer->deserialize($data);
    * Signature: $serialized_data = P5EEx::Blue::Serializer->deserialize($data);
    * Param:     $data              ref
    * Return:    $serialized_data   binary
    * Throws:    P5EEx::Blue::Exception::Serializer
    * Since:     0.01
    Sample Usage:
    $context = P5EEx::Blue::P5EE->context();
    $serializer = $context->service("Serializer");  # or ...
    $serializer = $context->serializer();
    $data = $serializer->deserialize($serialized_data);
    print $serializer->dump($data), "\n";

dump()

    * Signature: $perl = $serializer->dump($data);
    * Param:     $data      ref
    * Return:    $perl      text
    * Throws:    P5EEx::Blue::Exception::Serializer
    * Since:     0.01
    Sample Usage:
    $context = P5EEx::Blue::P5EE->context();
    $serializer = $context->service("Serializer");  # or ...
    $serializer = $context->serializer();
    $data = $serializer->deserialize($serialized_data);
    print $serializer->dump($data), "\n";


Protected Methods:

service_type()

Returns 'Serializer';

    * Signature: $service_type = P5EEx::Blue::Serializer->service_type();
    * Param:     void
    * Return:    $service_type  string
    * Since:     0.01
    $service_type = $widget->service_type();


ACKNOWLEDGEMENTS

 * Author:  Stephen Adkins <stephen.adkins@officevision.com>
 * License: This is free software. It is licensed under the same terms as Perl itself.


SEE ALSO

P5EEx::Blue::Context, P5EEx::Blue::Service