in reply to session management
I won't answer your question as such, but will give you an alternative instead.
If part of your aim is a learning exercise, why not handle the sessions yourself? In the web applications that I write, I am generally only interested in keeping track of people who are logged (or logging) into a particular system. To do this, I set some cookies:
Only the first of these is needed to maintain state - everything hangs off the user ID. So, when the user logs in, these cookies get set. Every time a page is loaded, one of the first things to happen is to read in the cookies from the HTTP request; once we've got the user ID cookie, we can then look up any state information that we might have saved in the database. (We could also save that state information directly in cookies; I tend not to do this because I don't want people altering cookies to fool my system.)
Here's a slightly modified and cut-down version of how I read in cookies (%cookies is declared elsewhere):
sub pop_cookies { my $rawcookies=$ENV{HTTP_COOKIE}; $rawcookies=~s/Cookie:|\s//ig; for my $nvp (split(/;/,$page{rawcookies})) { my ($n,$v)=split(/=/,$nvp); { $cookies{$n}=$v; } } }
I really think that if you build this yourself, you will understand how and why state preservation can/does work - and you will code a better application as a result. Modules are great but if, when you build your house, you also learn how to make bricks - you will gain that much more insight and experience.
Hope this helps!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: session management
by lostjimmy (Chaplain) on Sep 04, 2008 at 13:32 UTC | |
by smiffy (Pilgrim) on Sep 04, 2008 at 23:10 UTC | |
by Anonymous Monk on Dec 12, 2010 at 03:30 UTC | |
|
Re^2: session management
by Anonymous Monk on Sep 04, 2008 at 08:39 UTC | |
by smiffy (Pilgrim) on Sep 04, 2008 at 23:15 UTC | |
|
Re^2: session management
by Anonymous Monk on Sep 04, 2008 at 09:07 UTC | |
by Joost (Canon) on Sep 04, 2008 at 09:40 UTC | |
by smiffy (Pilgrim) on Sep 04, 2008 at 09:28 UTC |