line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CatalystX::Eta::Controller::AutoResultPUT; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1215
|
use Moose::Role; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
4
|
|
|
|
|
|
|
requires 'result_PUT'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
around result_PUT => \&AutoResult_around_result_PUT; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub AutoResult_around_result_PUT { |
9
|
1
|
|
|
1
|
|
6
|
my $orig = shift; |
10
|
1
|
|
|
|
|
2
|
my $self = shift; |
11
|
1
|
|
|
|
|
2
|
my ($c) = @_; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
4
|
my $something = $c->stash->{ $self->config->{object_key} }; |
14
|
|
|
|
|
|
|
|
15
|
1
|
50
|
|
|
|
132
|
my $data_from = $self->config->{data_from_body} ? 'data' : 'params'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
62
|
my $params = { %{ $c->req->$data_from } }; |
|
1
|
|
|
|
|
4
|
|
18
|
1
|
50
|
33
|
|
|
101
|
if ( exists $self->config->{prepare_params_for_update} |
19
|
|
|
|
|
|
|
&& ref $self->config->{prepare_params_for_update} eq 'CODE' ) { |
20
|
0
|
|
|
|
|
0
|
$params = $self->config->{prepare_params_for_update}->( $self, $c, $params ); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$something = $something->execute( |
24
|
|
|
|
|
|
|
$c, |
25
|
1
|
50
|
|
|
|
66
|
for => ( exists $c->stash->{result_put_for} ? $c->stash->{result_put_for} : 'update' ), |
26
|
|
|
|
|
|
|
with => $params, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
50
|
|
|
65913
|
my $primary_column = $self->config->{primary_key_column} || 'id'; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
115
|
my @params = @{ $c->req->captures }; |
|
1
|
|
|
|
|
9
|
|
32
|
1
|
|
|
|
|
95
|
$params[-1] = $something->$primary_column; |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
20
|
$self->status_accepted( |
35
|
|
|
|
|
|
|
$c, |
36
|
|
|
|
|
|
|
location => $c->uri_for( $self->action_for('result'), [@params] )->as_string, |
37
|
|
|
|
|
|
|
entity => { $primary_column => $something->$primary_column } |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
4748
|
$self->$orig(@_); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |