Updating my email address
[catagits/Catalyst-Action-Serialize-Data-Serializer.git] / lib / Catalyst / Action / Deserialize / YAML.pm
CommitLineData
256c894f 1#
2# Catlyst::Action::Deserialize::YAML.pm
be3c588a 3# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
256c894f 4# Created on: 10/12/2006 03:00:32 PM PDT
5#
6# $Id$
7
8package Catalyst::Action::Deserialize::YAML;
9
10use strict;
11use warnings;
12
13use base 'Catalyst::Action';
14use YAML::Syck;
256c894f 15
16sub execute {
17 my $self = shift;
18 my ( $controller, $c, $test ) = @_;
eccb2137 19
7ad87df9 20 my $body = $c->request->body;
21 if ($body) {
e601adda 22 my $rdata;
23 eval {
c28a55ff 24 my $body = $c->request->body;
25 $rdata = LoadFile( "$body" );
e601adda 26 };
27 if ($@) {
28 return $@;
29 }
256c894f 30 $c->request->data($rdata);
256c894f 31 } else {
eccb2137 32 $c->log->debug(
faf5c20b 33 'I would have deserialized, but there was nothing in the body!')
34 if $c->debug;
256c894f 35 }
e601adda 36 return 1;
eccb2137 37}
256c894f 38
391;