99b2678bdb789dc03c7a81306e2d3be94a70bb80
[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 # VERSION
10
11 sub execute {
12     my $self = shift;
13     my ( $controller, $c ) = @_;
14
15     my $stash_key = (
16             $controller->{'serialize'} ?
17                 $controller->{'serialize'}->{'stash_key'} :
18                 $controller->{'stash_key'} 
19         ) || 'rest';
20     my $output = $self->serialize($c->stash->{$stash_key});
21     $c->response->output( $output );
22     return 1;
23 }
24
25 sub serialize {
26     my $self = shift;
27     my $data = shift;
28     Dump($data);
29 }
30
31 __PACKAGE__->meta->make_immutable;
32
33 1;