File Coverage

lib/Catalyst/Action/Serialize/Callback.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition 1 2 50.0
subroutine 3 3 100.0
pod 1 1 100.0
total 17 18 94.4


line stmt bran cond sub pod time code
1             package Catalyst::Action::Serialize::Callback;
2             $Catalyst::Action::Serialize::Callback::VERSION = '1.19';
3 1     1   5 use Moose;
  1         1  
  1         8  
4 1     1   5301 use namespace::autoclean;
  1         3  
  1         9  
5              
6             extends 'Catalyst::Action';
7              
8             sub execute {
9 1     1 1 1 my $self = shift;
10 1         3 my ( $controller, $c, $callbacks ) = @_;
11              
12 1   50     7 my $stash_key = (
13             $controller->{'serialize'} ?
14             $controller->{'serialize'}->{'stash_key'} :
15             $controller->{'stash_key'}
16             ) || 'rest';
17 1         5 my $output = $callbacks->{serialize}->( $c->stash->{$stash_key}, $controller, $c );
18 1         104 $c->response->output( $output );
19 1         38 return 1;
20             }
21              
22             __PACKAGE__->meta->make_immutable;
23              
24             1;