summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-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;