line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sledge::Plugin::Private; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
25676
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
37
|
|
4
|
1
|
|
|
1
|
|
13
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
153
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub import { |
8
|
1
|
|
|
1
|
|
14
|
my $class = shift; |
9
|
1
|
|
|
|
|
4
|
my $pkg = caller(0); |
10
|
1
|
50
|
33
|
|
|
8
|
if ($_[0] && uc($_[0]) eq 'POST') { |
11
|
|
|
|
|
|
|
$pkg->register_hook( |
12
|
|
|
|
|
|
|
AFTER_INIT => sub { |
13
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
14
|
0
|
0
|
|
|
|
0
|
$self->set_private if $self->is_post_request; |
15
|
|
|
|
|
|
|
}, |
16
|
0
|
|
|
|
|
0
|
); |
17
|
|
|
|
|
|
|
} |
18
|
1
|
|
|
1
|
|
9
|
no strict 'refs'; ## no critic |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
130
|
|
19
|
1
|
|
|
|
|
3
|
*{"$pkg\::set_private"} = \&set_private; |
|
1
|
|
|
|
|
19
|
|
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub set_private { |
23
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
24
|
0
|
|
|
|
|
|
$self->r->header_out('Cache-Control' => 'private'); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
__END__ |