summary refs log tree commit diff
path: root/lib/MooseX/Net/API/Role/Deserialize.pm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/MooseX/Net/API/Role/Deserialize.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/MooseX/Net/API/Role/Deserialize.pm b/lib/MooseX/Net/API/Role/Deserialize.pm
new file mode 100644
index 0000000..105fb6b
--- /dev/null
+++ b/lib/MooseX/Net/API/Role/Deserialize.pm
@@ -0,0 +1,21 @@
+package MooseX::Net::API::Roles::Deserialize;
+
+use Moose::Role;
+use JSON::XS;
+use YAML::Syck;
+use XML::Simple;
+
+sub _from_json {
+    return decode_json( $_[1] );
+}
+
+sub _from_yaml {
+    return Dump $_[1];
+}
+
+sub _from_xml {
+    my $xml = XML::Simple->new( ForceArray => 0 );
+    $xml->XMLout( { data => $_[0] } );
+}
+
+1;