line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
798
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
69
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
63
|
|
3
|
|
|
|
|
|
|
package Plack::Middleware::Cleanup; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$Plack::Middleware::Cleanup::VERSION = '0.003'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
# ABSTRACT: Run cleanup code after request completion |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
13
|
use parent 'Plack::Middleware'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _guard (&) { |
13
|
1
|
|
|
1
|
|
8
|
bless $_[0], 'Plack::Middleware::Cleanup::Guard'; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub call { |
17
|
1
|
|
|
1
|
1
|
24811
|
my ($self, $env) = @_; |
18
|
1
|
|
|
|
|
2
|
my @queue; |
19
|
1
|
|
|
1
|
|
7
|
$env->{'cleanup.register'} = sub { push @queue, @_ }; |
|
1
|
|
|
|
|
96
|
|
20
|
|
|
|
|
|
|
$env->{'cleanup.guard'} = _guard { |
21
|
1
|
|
|
1
|
|
3
|
for my $item (@queue) { $item->() } |
|
1
|
|
|
|
|
3
|
|
22
|
1
|
|
|
|
|
9
|
}; |
23
|
1
|
|
|
|
|
13
|
return $self->app->($env); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
package Plack::Middleware::Cleanup::Guard; |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
$Plack::Middleware::Cleanup::Guard::VERSION = '0.003'; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
1
|
|
2309
|
sub DESTROY { $_[0]->() } |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |