如何在 Catalyst 中创建会话?
尝试弄清楚如何在 Catalyst 中创建、存储和检索会话信息。有什么建议吗?
Trying to figure our how to create, store and retrieve session info in Catalyst. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你只需要将相关的session插件添加到你的
use Catalyst
行即可,即:...然后你可以参考
$c->session->{key} 从那里。有一些关于 cookie 年龄等的可配置项,但默认值是合理的。这应该可以帮助你开始。
(当然,如果您尚未安装这些与会话相关的模块,您可能需要从 CPAN 安装这些模块。)
You need only to add the relevant session plugins to your
use Catalyst
line, ie:... and then you can refer to
$c->session->{key}
from there. There are some configurables about cookie age and so on, but the defaults are sane. That should get you started.(Of course, you may need to install those Session-related modules from CPAN, if they're not available to you already.)
请参阅 Catalyst::Manual::Tutorial::05_Authentication 。
See Catalyst::Manual::Tutorial::05_Authentication.
只需使用 另一个 Catalyst 会话教程 更新此答案,该教程是 另一个 Catalyst 会话教程 ="http://search.cpan.org/dist/Catalyst-Plugin-Session" rel="nofollow">Catalyst::Plugin::Session 分发。看起来很容易理解,并且包含会话背后的基本概念
Just updating this answer with another Catalyst Session tutorial that is part of the Catalyst::Plugin::Session distribution. Seems easy to follow, and includes the basic concepts behind sessions