| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
336302
|
use strictures 2; |
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
53
|
|
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Dancer2::Plugin::Shutdown; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: Graceful shutdown your Dancer2 application |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
629
|
use Dancer2::Plugin; |
|
|
1
|
|
|
|
|
1662
|
|
|
|
1
|
|
|
|
|
5
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'Dancer2::Plugin::Role::Shutdown'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
on_plugin_import { |
|
14
|
|
|
|
|
|
|
my $self = shift; |
|
15
|
|
|
|
|
|
|
$self->app->add_hook( |
|
16
|
|
|
|
|
|
|
Dancer2::Core::Hook->new( |
|
17
|
|
|
|
|
|
|
name => 'before', |
|
18
|
|
|
|
|
|
|
code => sub { $self->before_hook(@_) }, |
|
19
|
|
|
|
|
|
|
) |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
}; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
register shutdown_at => \&_shutdown_at; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
register shutdown_session_validator => sub { |
|
28
|
0
|
|
|
0
|
|
|
shift->validator(@_) |
|
29
|
|
|
|
|
|
|
}, { is_global => 1 }; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
register_plugin; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |