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