File Coverage

blib/lib/Yeb/Plugin/Session.pm
Criterion Covered Total %
statement 10 18 55.5
branch n/a
condition n/a
subroutine 4 8 50.0
pod 0 1 0.0
total 14 27 51.8


line stmt bran cond sub pod time code
1             package Yeb::Plugin::Session;
2             BEGIN {
3 1     1   2741 $Yeb::Plugin::Session::AUTHORITY = 'cpan:GETTY';
4             }
5             # ABSTRACT: Yeb Plugin for Plack::Middleware::Session
6             $Yeb::Plugin::Session::VERSION = '0.100';
7 1     1   1613 use Moo;
  1         47075  
  1         10  
8 1     1   11147 use Plack::Middleware::Session;
  1         43426  
  1         32  
9 1     1   9874 use Plack::Session::Store::File;
  1         9422  
  1         256  
10              
11             has app => ( is => 'ro', required => 1, weak_ref => 1 );
12              
13             sub BUILD {
14 0     0 0   my ( $self ) = @_;
15 0           $self->app->add_middleware(Plack::Middleware::Session->new(
16             store => Plack::Session::Store::File->new
17             ));
18             $self->app->register_function('session',sub {
19 0     0     $self->app->hash_accessor_empty($self->app->cc->env->{'psgix.session'},@_);
20 0           });
21             $self->app->register_function('session_has',sub {
22 0     0     $self->app->hash_accessor_has($self->app->cc->env->{'psgix.session'},@_);
23 0           });
24             $self->app->register_function('clear_session',sub {
25 0     0     $self->app->cc->env->{'psgix.session'} = {};
26 0           });
27             }
28              
29             1;
30              
31             __END__