line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::Action::Serialize::View; |
2
|
|
|
|
|
|
|
$Catalyst::Action::Serialize::View::VERSION = '1.21'; |
3
|
1
|
|
|
1
|
|
6
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
4
|
1
|
|
|
1
|
|
5827
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
extends 'Catalyst::Action'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub execute { |
9
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
10
|
2
|
|
|
|
|
6
|
my ( $controller, $c, $view ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
2
|
50
|
|
|
|
37
|
return 1 if $c->response->status =~ /^(?:204|3\d\d)$/; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $stash_key = ( |
17
|
|
|
|
|
|
|
$controller->{'serialize'} ? |
18
|
|
|
|
|
|
|
$controller->{'serialize'}->{'stash_key'} : |
19
|
2
|
|
50
|
|
|
183
|
$controller->{'stash_key'} |
20
|
|
|
|
|
|
|
) || 'rest'; |
21
|
|
|
|
|
|
|
|
22
|
2
|
50
|
|
|
|
13
|
if ( !$c->view($view) ) { |
23
|
0
|
|
|
|
|
0
|
$c->log->error("Could not load $view, refusing to serialize"); |
24
|
0
|
|
|
|
|
0
|
return; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
2
|
100
|
|
|
|
144
|
if ($c->view($view)->process($c, $stash_key)) { |
28
|
1
|
|
|
|
|
105
|
return 1; |
29
|
|
|
|
|
|
|
} else { |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
33
|
|
|
78
|
my $error = join("\n", @{ $c->error }) || "Error in $view"; |
32
|
1
|
|
|
|
|
9
|
$error .= "\n"; |
33
|
1
|
|
|
|
|
7
|
$c->clear_errors; |
34
|
1
|
|
|
|
|
11
|
die $error; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|