Dancer2 Session不写入文件

时间:2016-04-02 18:52:27

标签: perl dancer

在我的Dancer2应用程序中,我发现会话信息不存储在文件请求之间。我使用YAML作为会话商店格式。

e.g。

我已经定义了一个测试路径来在会话中设置变量,并使用模板中的Data Dumper将设置和会话变量转储到模板中。

get '/test' => sub {
session("a"=>1);
template 'test';
};

Data Dumper的结果是

$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/'
}
}
},

会话var

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

此时我希望我的/ tmp目录包含会话文件夹,但我看到以下

starman@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

我无法弄清楚为什么没有创建会话文件。关于我的错误的任何指示都会有所帮助

修改 添加更多信息。 我已经修改了测试路径以获取存储在会话中的2个参数键和值,如下所示。

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

我的test.tt如下

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

此路线的实时网址为

Live URL

我仍然没有在/ tmp /文件夹中看到任何文件夹

0 个答案:

没有答案
相关问题