| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Ark::Plugin::Session; | 
| 2 | 9 |  |  | 9 |  | 5583 | use strict; | 
|  | 9 |  |  |  |  | 21 |  | 
|  | 9 |  |  |  |  | 357 |  | 
| 3 | 9 |  |  | 9 |  | 53 | use warnings; | 
|  | 9 |  |  |  |  | 24 |  | 
|  | 9 |  |  |  |  | 247 |  | 
| 4 | 9 |  |  | 9 |  | 4515 | use Ark::Plugin; | 
|  | 9 |  |  |  |  | 25 |  | 
|  | 9 |  |  |  |  | 62 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | has session => ( | 
| 7 |  |  |  |  |  |  | is      => 'rw', | 
| 8 |  |  |  |  |  |  | isa     => 'Ark::Plugin::Session::Backend', | 
| 9 |  |  |  |  |  |  | lazy    => 1, | 
| 10 |  |  |  |  |  |  | default => sub { | 
| 11 |  |  |  |  |  |  | my $self = shift; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | my $conf  = $self->app->config->{'Plugin::Session'} || {}; | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | $self->app->ensure_class_loaded('Ark::Plugin::Session::Backend'); | 
| 16 |  |  |  |  |  |  | my $class = $self->app->class_wrapper( | 
| 17 |  |  |  |  |  |  | name => 'Session', | 
| 18 |  |  |  |  |  |  | base => 'Ark::Plugin::Session::Backend', | 
| 19 |  |  |  |  |  |  | ); | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | $class->new(%$conf, app => $self->app); | 
| 22 |  |  |  |  |  |  | }, | 
| 23 |  |  |  |  |  |  | ); | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | before finalize => sub { | 
| 26 |  |  |  |  |  |  | my $context = shift; | 
| 27 |  |  |  |  |  |  | return unless $context->{session}; | 
| 28 |  |  |  |  |  |  | $context->session->finalize_session( $context->response ); | 
| 29 |  |  |  |  |  |  | }; | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | 1; |