diff options
Diffstat (limited to 'lib/Net/HTTP/API/Parser/XML.pm')
-rw-r--r-- | lib/Net/HTTP/API/Parser/XML.pm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Net/HTTP/API/Parser/XML.pm b/lib/Net/HTTP/API/Parser/XML.pm new file mode 100644 index 0000000..aaedfcd --- /dev/null +++ b/lib/Net/HTTP/API/Parser/XML.pm @@ -0,0 +1,30 @@ +package Net::HTTP::API::Parser::XML; + +# ABSTRACT: Parse XML result + +use XML::Simple; +use Moose; +extends 'Net::HTTP::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 |