summary refs log tree commit diff
path: root/lib/MooseX/Net/API/Parser/XML.pm
blob: f831cf1130b4de655ba9a8a3391267c42c509cac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package MooseX::Net::API::Parser::XML;

use XML::Simple;
use Moose;
extends 'MooseX::Net::API::Parser';

has _xml_parser(
    is      => 'rw',
    isa     => 'XML::Simple',
    lazy    => 1,
    default => sub { XML::SImple->new(ForceArray => 0) }
);

sub encode {
    my ($self, $content) = @_;
    return $self->_xml_parser->XMLin($content);
}

sub decode {
    my ($self, $content) = @_;
    return $self->_xml_parser->XMLout($content);
}

1;