in reply to Re: Writing web pages in Perl with sessions
in thread Writing web pages in Perl with sessions

I, too, must advocate the use of Apache::Session. According to a history of the module I read, it has little to do with Apache or Sessions itself and is called "Apache::Session" purely for historical reasons.

Apache::Session is the underlying framework to implement your own session system. It's basically an interface to an object store. You tie a hash to, lets say Apache::Session::DBI, use your hash as you like, then when you come back with an id of some sort (from a cookie perhaps, or a session url like http://example.com/session/3F48dfj12578w), your hash will be restored.

The nice thing is that storage methods for files and numerous databases are available. Check out the perldoc on it for some examples. As one who rolled his own session management system before discovering this, I highly recommend using this before reinventing another wheel. =)

-Ducky

  • Comment on Re: Re: Writing web pages in Perl with sessions

Replies are listed 'Best First'.
Re: Writing web pages in Perl with sessions
by fx (Pilgrim) on Sep 13, 2001 at 01:26 UTC

    So, Apache::Session is perhaps the way to go - I shall look at that.

    However, I am still wondering, is there a way to use memory? Surely this would provide quicker storage/access? I seem to remember a particular web-based e-mail client (IMP perhaps?...) using shared memory as a session store...

    fx

      Hmmm memory only, huh... you might want to look into IPC::Shareable and build a perl data server separate from the web server. You need a separate data server because when the web server gets a cgi request it forks perl - when perl's done with the request it completely exits.

      The perldoc for IPC::Shareable has an example of a data server, too. =)

      -Ducky