Fix failing test. Normalize method names
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Action / Serialize / YAML.pm
CommitLineData
256c894f 1#
9a76221e 2# Catalyst::Action::Serialize::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::Serialize::YAML;
9
10use strict;
11use warnings;
12
13use base 'Catalyst::Action';
14use YAML::Syck;
15
16sub execute {
17 my $self = shift;
e601adda 18 my ( $controller, $c ) = @_;
256c894f 19
faf5c20b 20 my $stash_key = (
07682cbc 21 $controller->{'serialize'} ?
22 $controller->{'serialize'}->{'stash_key'} :
23 $controller->{'stash_key'}
faf5c20b 24 ) || 'rest';
e601adda 25 my $output;
26 eval {
485b5160 27 $output = $self->serialize($c->stash->{$stash_key});
e601adda 28 };
29 if ($@) {
30 return $@;
31 }
32 $c->response->output( $output );
256c894f 33 return 1;
eccb2137 34}
256c894f 35
485b5160 36sub serialize {
37 my $self = shift;
38 my $data = shift;
39 Dump($data);
40}
41
256c894f 421;