P5EEx-Blue-0.01

P5EEx::Blue::Serializer::XMLSimple


NAME

P5EEx::Blue::Serializer::XMLSimple - 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',
        },
    };
    $xml = $serializer->serialize($data);
    $data = $serializer->deserialize($xml);
    print $serializer->dump($data), "\n";


DESCRIPTION

A Serializer allows you to serialize a structure of data of arbitrary depth to a scalar and deserialize it back to the structure.

The XMLSimple serializer uses non-validated XML as the serialized form of the data. It uses the XML::Simple class to perform the deserialization and serialization.


Class: P5EEx::Blue::Serializer::XMLSimple

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

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: $xml = $serializer->serialize($data);
    * Param:     $data              ref
    * Return:    $xml               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 = {
        an => 'arbitrary',
        collection => [ 'of', 'data', ],
        of => {
            arbitrary => 'depth',
        },
    };
    $xml = $serializer->serialize($data);

deserialize()

    * Signature: $data = $serializer->deserialize($xml);
    * Signature: $data = P5EEx::Blue::Serializer->deserialize($xml);
    * Param:     $data              ref
    * Return:    $xml               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($xml);
    print $serializer->dump($data), "\n";

dump()

This method is inherited from P5EEx::Blue::Serializer.


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