c3f900394aef53871b1b412c02045011760ff4cb
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Action / Serialize / YAML.pm
1 package Catalyst::Action::Serialize::YAML;
2
3 use Moose;
4 use namespace::autoclean;
5
6 extends 'Catalyst::Action';
7 use YAML::Syck;
8
9 sub execute {
10     my $self = shift;
11     my ( $controller, $c ) = @_;
12
13     my $stash_key = (
14             $controller->{'serialize'} ?
15                 $controller->{'serialize'}->{'stash_key'} :
16                 $controller->{'stash_key'} 
17         ) || 'rest';
18     my $output = $self->serialize($c->stash->{$stash_key});
19     $c->response->output( $output );
20     return 1;
21 }
22
23 sub serialize {
24     my $self = shift;
25     my $data = shift;
26     Dump($data);
27 }
28
29 1;