[dancer-users] Dancer2 session file not being created.

vijayvithal jahagirdar jahagirdar.vs at gmail.com
Sun Apr 3 21:12:47 BST 2016

0down votefavorite

In my Dancer2 app I find that the session information is not stored in
between file request. I am using YAML as my session store format.


I have defined a test route to set a variable in the session and dump the
settings and session variable in the template using Data Dumper in the

get '/test/:key/:value' => sub { my $key =params->{key}; my $value =params
->{value}; session($key=>$value); template 'test';};

The result of Data Dumper is

$VAR1 = {'engines' => {'template' => {'template_toolkit' =>
{'start_tag' => '<%','end_tag' => '%>'}},'session' => {'YAML' =>
{'cookie_name' => 'domain.session','is_secure' => '1','is_http_only'
=> '1','session_dir' => '/tmp/dancer-sessions/'}}},

And session var is

$VAR1 = {'a' => 1};

At this point I expect my /tmp directory to contain a session folder but I
see the following

starman at ubuntu:~/www/app$ ls -al /tmp
total 776
drwxrwxrwt  2 root    root      4096 Apr  2 14:39 .
drwxr-xr-x 21 root    root      4096 Apr  2 07:31 ..-rw-r--r--  1
starman starman 776737 Apr  2 14:31 starman.err-rw-r--r--  1 starman
starman      0 Apr  2 07:31 starman.out-rw-r--r--  1 starman starman
   4 Apr  2 14:31 starman.pid

I am unable to figure out why the session file is not getting created. Any
pointers on my mistake will be helpful

My test.tt is as follows

<%USE Dumper%><h1> Dumping the settings variable </h1>
<h1> Dumping the session variable </h1><%Dumper.dump_html(session)%>

The live url for this route is

Live URL
Note: I am launching 2 separate domain using a common app.psgi file whose
content is as follows

use Plack::Builder;
use Dancer2 ':syntax';
use lib '/home/starman/www/dyumnin/lib';
use lib '/home/starman/www/edaindia/lib';

use dyumnin;
use edaindia;

builder {
    mount 'http://edaindia.com/'      => edaindia->to_app;
    mount 'http://dyumnin.com/' => dyumnin->to_app;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20160404/1debe639/attachment.html>

More information about the dancer-users mailing list