Dancer2-Serializer-XML

 view release on metacpan or  search on metacpan

lib/Dancer2/Serializer/XML.pm  view on Meta::CPAN

use Moo;
use Dancer2;	# So that setting is available in tests
use Class::Load 'load_class';
with 'Dancer2::Core::Role::Serializer';

our $VERSION = '0.06';

has '+content_type' => ( default => sub {'application/xml'} );
has 'xml_options' => 
( 
	default => sub { {RootName => 'data', KeyAttr => [], AttrIndent => 1} },
	is => 'rw'
);

sub BUILD
{
    my ($self) = @_;
    die 'XML::Simple is needed and is not installed' unless $self->loaded_xmlsimple;
    die 'XML::Simple needs XML::Parser or XML::SAX and neither is installed' unless $self->loaded_xmlbackends;
}

lib/Dancer2/Serializer/XML.pm  view on Meta::CPAN

   									ForceArray => 1,
   									KeepRoot => 1
   									}
   					};

In config:

   engines:
      serializer:
        serialize:
           AttrIndent: 1
           KeyAttr: []
        deserialize:
           ForceArray: 1
           KeyAttr: []
           ForceContent: 1
           KeepRoot: 1

=head1 SEE ALSO / EXAMPLES

L<XML::Simple>



( run in 0.231 second using v1.01-cache-2.11-cpan-4d50c553e7e )