Port Serialize classes except for View.
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Action / Serialize / YAML.pm
CommitLineData
256c894f 1package Catalyst::Action::Serialize::YAML;
2
930013e6 3use Moose;
4use namespace::autoclean;
256c894f 5
930013e6 6extends 'Catalyst::Action';
256c894f 7use YAML::Syck;
8
9sub execute {
10 my $self = shift;
e601adda 11 my ( $controller, $c ) = @_;
256c894f 12
faf5c20b 13 my $stash_key = (
07682cbc 14 $controller->{'serialize'} ?
15 $controller->{'serialize'}->{'stash_key'} :
16 $controller->{'stash_key'}
faf5c20b 17 ) || 'rest';
71cbfa6b 18 my $output = $self->serialize($c->stash->{$stash_key});
e601adda 19 $c->response->output( $output );
256c894f 20 return 1;
eccb2137 21}
256c894f 22
485b5160 23sub serialize {
24 my $self = shift;
25 my $data = shift;
26 Dump($data);
27}
28
256c894f 291;