Hello (yet again),
On 09/27/2012 11:15 AM, Assaf Gordon wrote:
Assaf Gordon wrote, On 09/24/2012 01:48 PM:
I want to maintain a "session" (i.e. collection of server-side variables) for each open
browser window (not browser "session" in the technical sense).
I implemented such a mechanism as a Dancer Plugin:
Dancer::Plugin::WindowSession .
See it in action here:
http://winsid.cancan.cshl.edu/
The source code for the plugin (and the demo) are here:
https://github.com/agordon/Dancer-Plugin-WindowSession
(and soon in CPAN).
On the Perl side, simply use "window_session" keyword instead of "session"
keyword.
On the template side, you'll need to pass along the "winsid" (=window session
id) as a CGI parameter to every URL and POST request.
See code example here (that's the method that generates the plot for the demo):
https://github.com/agordon/Dancer-Plugin-WindowSession/blob/master/eg/example/lib/window_session_test.pm#L28
It uses the same session mechanism defined in the config.yml, and only uses
standard Dancer keywords (no ugly hacking),
so I hope it will be stable and portable for Dancer2 .
Comments are welcomed,
-gordon
_______________________________________________
Dancer-users mailing list
[email protected]
http://www.backup-manager.org/cgi-bin/listinfo/dancer-users