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