Commit | Line | Data |
---|---|---|
256c894f | 1 | package Catalyst::Action::Serialize::YAML; |
2 | ||
930013e6 | 3 | use Moose; |
4 | use namespace::autoclean; | |
256c894f | 5 | |
930013e6 | 6 | extends 'Catalyst::Action'; |
256c894f | 7 | use YAML::Syck; |
8 | ||
9 | sub 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'; |
7f36b63e | 18 | my $output = $self->serialize($c->stash->{$stash_key}); |
e601adda | 19 | $c->response->output( $output ); |
256c894f | 20 | return 1; |
eccb2137 | 21 | } |
256c894f | 22 | |
485b5160 | 23 | sub serialize { |
24 | my $self = shift; | |
25 | my $data = shift; | |
26 | Dump($data); | |
27 | } | |
28 | ||
24748286 | 29 | __PACKAGE__->meta->make_immutable; |
30 | ||
256c894f | 31 | 1; |