Commit | Line | Data |
178f8470 |
1 | package Catalyst::Action::Serialize::Callback; |
2 | |
3 | use Moose; |
4 | use namespace::autoclean; |
5 | |
6 | extends 'Catalyst::Action'; |
7 | use YAML::Syck; |
8 | |
1c4b501b |
9 | our $VERSION = '0.93'; |
178f8470 |
10 | $VERSION = eval $VERSION; |
11 | |
12 | sub execute { |
13 | my $self = shift; |
14 | my ( $controller, $c, $callbacks ) = @_; |
15 | |
16 | my $stash_key = ( |
17 | $controller->{'serialize'} ? |
18 | $controller->{'serialize'}->{'stash_key'} : |
19 | $controller->{'stash_key'} |
20 | ) || 'rest'; |
21 | my $output = $callbacks->{serialize}->( $c->stash->{$stash_key}, $controller, $c ); |
22 | $c->response->output( $output ); |
23 | return 1; |
24 | } |
25 | |
26 | __PACKAGE__->meta->make_immutable; |
27 | |
28 | 1; |