Cot::Plugin::Session - Cot framework Simple session plugin.
use Cot; use Cot::Plugin qw/Session/; get '/sign/in' => sub { my $self = shift; my $sess = $self->session->load; my $id = $sess->get('id'); $sess->set('id', 'yshibata') unless $id; $sess->bakecookie(path => '/', expires => time + 24 * 60 * 60,); #code };
Cot::Plugin::Session is Cot framework Simple session plugin. using $cot->session namespace. Session file stored to $ENV{TMPDIR} or /tmp as a YAML file.
Retrieve value with key from session object.
use Cot; use Cot::Plugin qw/Session/; get '/sign/in' => sub { my $self = shift; my $sess = $self->session->load; my $id = $sess->get('id'); #code };
Store value with key to session object.
my $sess = $self->session->load; $sess->set('id', 'yshibata');
Delete session object.
my $sess = $self->session->load; $sess->delete;
Bake session id COOKIE to HTTP header.
my $sess = $self->session->load; $sess->bakecookie(path => '/', expires => time + 24 * 60 * 60, domain => '.example.com',);
Copyright (C) Yusuke Shibata
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Yusuke Shibata <shibata@yusukeshibata.jp>
To install Cot::Plugin::Session, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cot::Plugin::Session
CPAN shell
perl -MCPAN -e shell install Cot::Plugin::Session
For more information on module installation, please visit the detailed CPAN module installation guide.