App-Context

 view release on metacpan or  search on metacpan

lib/App/Serializer/Xml.pm  view on Meta::CPAN


#############################################################################
## $Id: Xml.pm 6783 2006-08-11 17:43:28Z spadkins $
#############################################################################

package App::Serializer::Xml;
$VERSION = (q$Revision: 6783 $ =~ /(\d[\d\.]*)/)[0];  # VERSION numbers generated by svn

use App;
use App::Serializer;
@ISA = ( "App::Serializer" );

use strict;

=head1 NAME

App::Serializer::Xml - Interface for serialization and deserialization

=head1 SYNOPSIS

    use App;

    $context = App->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";

=head1 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 Xml serializer uses non-validated XML as the serialized
form of the data.  It uses the XML::Simple class to perform
the deserialization and serialization.

=cut

#############################################################################
# CLASS
#############################################################################

=head1 Class: App::Serializer::Xml

 * Throws: App::Exception::Serializer
 * Since:  0.01

=head2 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.

=cut

#############################################################################
# CONSTRUCTOR METHODS
#############################################################################

=head1 Constructor Methods:

=cut

#############################################################################
# new()
#############################################################################

=head2 new()

The constructor is inherited from
L<C<App::Service>|App::Service/"new()">.

=cut

#############################################################################
# PUBLIC METHODS
#############################################################################

=head1 Public Methods:

=cut

#############################################################################
# serialize()
#############################################################################

=head2 serialize()

    * Signature: $xml = $serializer->serialize($data);
    * Param:     $data              ref
    * Return:    $xml               text
    * Throws:    App::Exception::Serializer
    * Since:     0.01



( run in 1.252 second using v1.01-cache-2.11-cpan-39bf76dae61 )