line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pickles::Controller; |
2
|
10
|
|
|
10
|
|
1306
|
use strict; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
477
|
|
3
|
10
|
|
|
10
|
|
894
|
use Class::Trigger qw(pre_action post_action); |
|
10
|
|
|
|
|
1439
|
|
|
10
|
|
|
|
|
84
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub new { |
6
|
3
|
|
|
3
|
0
|
6
|
my( $class ) = @_; |
7
|
3
|
|
|
|
|
10
|
my $self = bless {}, $class; |
8
|
3
|
|
|
|
|
12
|
$self; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub init { |
12
|
1
|
|
|
1
|
0
|
3
|
my( $self, $c ) = @_; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub execute { |
16
|
4
|
|
|
4
|
0
|
9
|
my( $self, $action, $c ) = @_; |
17
|
4
|
|
|
|
|
18
|
my $config = $c->config; |
18
|
4
|
50
|
|
|
|
29
|
if ( my $prefix = $config->{'ACTION_PREFIX'} ) { |
19
|
0
|
|
|
|
|
0
|
$action = $prefix. $action; |
20
|
|
|
|
|
|
|
} |
21
|
4
|
|
|
|
|
25
|
$self->call_trigger( 'pre_action', $c, $action ); |
22
|
4
|
|
|
|
|
303
|
$self->$action( $c ); |
23
|
4
|
|
|
|
|
214
|
$self->call_trigger( 'post_action', $c, $action ); |
24
|
4
|
|
|
|
|
241
|
return 1; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub REPLY { |
28
|
0
|
|
|
0
|
0
|
|
my ($self, $c, $status) = @_; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
require HTTP::Status; |
31
|
0
|
|
|
|
|
|
my $res = $c->res; |
32
|
0
|
|
|
|
|
|
$res->status( $status ); |
33
|
0
|
|
|
|
|
|
$res->content_type('text/plain'); |
34
|
0
|
|
|
|
|
|
$res->body( HTTP::Status::status_message( $status ) ); |
35
|
0
|
|
|
|
|
|
return $res; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
BEGIN { |
39
|
10
|
|
|
10
|
|
27
|
foreach my $code (403, 404, 500) { |
40
|
10
|
|
|
10
|
|
3502
|
no strict 'refs'; |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
338
|
|
41
|
10
|
|
|
10
|
|
52
|
no warnings 'redefine'; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
1205
|
|
42
|
30
|
|
|
|
|
102
|
my $method = "res$code"; |
43
|
30
|
|
|
|
|
355
|
*{$method} = sub { |
44
|
0
|
|
|
0
|
|
0
|
my ($self, $c) = @_; |
45
|
0
|
|
|
|
|
0
|
$self->REPLY($c, $code); |
46
|
0
|
|
|
|
|
0
|
$c->finished(1); |
47
|
0
|
|
|
|
|
0
|
$c->abort(); |
48
|
30
|
|
|
|
|
123
|
}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |