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.20';
3 1     1   5 use Moose;
  1         2  
  1         10  
4 1     1   6681 use namespace::autoclean;
  1         2  
  1         11  
5              
6             extends 'Catalyst::Action';
7              
8             sub execute {
9 1     1 1 14 my $self = shift;
10 1         3 my ( $controller, $c, $callbacks ) = @_;
11              
12             my $stash_key = (
13             $controller->{'serialize'} ?
14             $controller->{'serialize'}->{'stash_key'} :
15 1   50     12 $controller->{'stash_key'}
16             ) || 'rest';
17 1         7 my $output = $callbacks->{serialize}->( $c->stash->{$stash_key}, $controller, $c );
18 1         124 $c->response->output( $output );
19 1         148 return 1;
20             }
21              
22             __PACKAGE__->meta->make_immutable;
23              
24             1;