Commit | Line | Data |
9a76221e |
1 | package Catalyst::Action::Serialize::View; |
2 | use strict; |
3 | use warnings; |
4 | |
5 | use base 'Catalyst::Action'; |
6 | |
7 | sub execute { |
8 | my $self = shift; |
9 | my ( $controller, $c, $view ) = @_; |
faf5c20b |
10 | |
11 | my $stash_key = ( |
12 | $controller->config->{'serialize'} ? |
13 | $controller->config->{'serialize'}->{'stash_key'} : |
14 | $controller->config->{'stash_key'} |
15 | ) || 'rest'; |
9a76221e |
16 | |
17 | if ( !$c->view($view) ) { |
18 | $c->log->error("Could not load $view, refusing to serialize"); |
19 | return 0; |
20 | } |
21 | |
22 | return $c->view($view)->process($c); |
23 | } |
24 | |
25 | 1; |