summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2009-12-08 16:11:58 +0100
committerfranck cuny <franck@lumberjaph.net>2009-12-08 16:11:58 +0100
commit1551d1e17735060fcb76ebb71bb26a964518b9b1 (patch)
treefb10e2b249781246a7d15c5564c6e45dab25c1a0
parentChecking in changes prior to tagging of version 0.02. Changelog diff is: (diff)
downloadmoosex-net-api-1551d1e17735060fcb76ebb71bb26a964518b9b1.tar.gz
move serialize into a role
-rw-r--r--lib/MooseX/Net/API/Role/Serialize.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/MooseX/Net/API/Role/Serialize.pm b/lib/MooseX/Net/API/Role/Serialize.pm
index 1218af3..016a290 100644
--- a/lib/MooseX/Net/API/Role/Serialize.pm
+++ b/lib/MooseX/Net/API/Role/Serialize.pm
@@ -10,7 +10,7 @@ sub _to_json {
 }
 
 sub _to_yaml {
-    return Load $_[1];
+    return Dump $_[1];
 }
 
 sub _to_xml {
@@ -18,4 +18,16 @@ sub _to_xml {
     $xml->XMLin("$_[0]");
 }
 
+sub _do_serialization {
+    my ( $caller, $content, $format ) = @_;
+
+    my $format_content;
+    my $method = '_to_' . $format;
+    return if ( !$caller->meta->find_method_by_name($method) );
+    try {
+        $format_content = $caller->$method($content);
+    };
+    return $format_content if $format_content;
+}
+
 1;