about summary refs log tree commit diff
path: root/lib/MooseX/Net/API/Parser/XML.pm
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-06-03 10:01:01 +0200
committerfranck cuny <franck@lumberjaph.net>2010-06-03 10:01:01 +0200
commit3da11a8153d3b42af2f2a250008be6cc52e57b09 (patch)
tree4da02b541e9f8d35e5f20d63908cd33fe64dc7f8 /lib/MooseX/Net/API/Parser/XML.pm
parentreplace remainging with nothing (diff)
parentfix attribute declaration (diff)
downloadnet-http-api-3da11a8153d3b42af2f2a250008be6cc52e57b09.tar.gz
merge
Diffstat (limited to 'lib/MooseX/Net/API/Parser/XML.pm')
-rw-r--r--lib/MooseX/Net/API/Parser/XML.pm50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/MooseX/Net/API/Parser/XML.pm b/lib/MooseX/Net/API/Parser/XML.pm
new file mode 100644
index 0000000..7198175
--- /dev/null
+++ b/lib/MooseX/Net/API/Parser/XML.pm
@@ -0,0 +1,50 @@
+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;
+__END__
+
+=head1 NAME
+
+MooseX::Net::API::Parser::XML
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+=head1 AUTHOR
+
+franck cuny E<lt>franck@lumberjaph.netE<gt>
+
+=head1 SEE ALSO
+
+=head1 LICENSE
+
+Copyright 2010 by Linkfluence
+
+http://linkfluence.net
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut