diff options
author | franck cuny <franck@lumberjaph.net> | 2009-12-08 16:11:58 +0100 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2009-12-08 16:11:58 +0100 |
commit | 1551d1e17735060fcb76ebb71bb26a964518b9b1 (patch) | |
tree | fb10e2b249781246a7d15c5564c6e45dab25c1a0 | |
parent | Checking in changes prior to tagging of version 0.02. Changelog diff is: (diff) | |
download | moosex-net-api-1551d1e17735060fcb76ebb71bb26a964518b9b1.tar.gz |
move serialize into a role
-rw-r--r-- | lib/MooseX/Net/API/Role/Serialize.pm | 14 |
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; |