1 package Catalyst::Action::Serialize::View;
3 use namespace::autoclean;
5 extends 'Catalyst::Action';
8 $VERSION = eval $VERSION;
12 my ( $controller, $c, $view ) = @_;
14 # Views don't care / are not going to render an entity for 3XX
16 return 1 if $c->response->status =~ /^(?:204|3\d\d)$/;
19 $controller->{'serialize'} ?
20 $controller->{'serialize'}->{'stash_key'} :
21 $controller->{'stash_key'}
24 if ( !$c->view($view) ) {
25 $c->log->error("Could not load $view, refusing to serialize");
29 if ($c->view($view)->process($c, $stash_key)) {
32 # This is stupid. Please improve it.
33 my $error = join("\n", @{ $c->error }) || "Error in $view";
40 __PACKAGE__->meta->make_immutable;