summary refs log tree commit diff
path: root/lib/MooseX/Net/API/Parser/XML.pm
blob: 305d4b406e903d91bb7240f75b83cdf25d113409 (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
25
26
27
28
29
30
package MooseX::Net::API::Parser::XML;

# ABSTRACT: Parse XML result

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;

=head1 SYNOPSIS

=head1 DESCRIPTION