Bump versions for release
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Action / Deserialize / YAML.pm
CommitLineData
256c894f 1package Catalyst::Action::Deserialize::YAML;
2
930013e6 3use Moose;
4use namespace::autoclean;
256c894f 5
930013e6 6extends 'Catalyst::Action';
256c894f 7use YAML::Syck;
256c894f 8
3bb36dca 9our $VERSION = '0.82';
6edee33e 10$VERSION = eval $VERSION;
11
256c894f 12sub execute {
13 my $self = shift;
14 my ( $controller, $c, $test ) = @_;
eccb2137 15
7ad87df9 16 my $body = $c->request->body;
17 if ($body) {
e601adda 18 my $rdata;
19 eval {
c28a55ff 20 my $body = $c->request->body;
21 $rdata = LoadFile( "$body" );
e601adda 22 };
23 if ($@) {
24 return $@;
25 }
256c894f 26 $c->request->data($rdata);
256c894f 27 } else {
eccb2137 28 $c->log->debug(
faf5c20b 29 'I would have deserialized, but there was nothing in the body!')
30 if $c->debug;
256c894f 31 }
e601adda 32 return 1;
eccb2137 33}
256c894f 34
351;