Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hey there monks.

I've recently decided to see what was available for handling sessions in Perl. I've done sessions in Java, which is rather simple (being built into Servlets and all), and I've done my own in Perl with CGI apps before.

So, using mod_perl, what are people's opinions about the best method for handling sessions? Apache::Session seems to be what all the books and websites talk about, but I had many problems that others seem to have (but found no final answer). I find that data I put into my tied hash don't seem to stick. But on occasion it does.

I thought this might be due to my using PostgreSQL for the Store. So I tried the File store. I had similar behavior. My only thought is that it's something related to MacOS X's perl implementation (5.6.0). Hopefully that will be updated soon. I found people with the same questions over the years in archived discussion forums. But few answers.

So, I tried CGI::Session. Although not accurately documented, it does work with PostgreSQL and other stuff. I don't know how "safe" it is for mod_perl though. Also, CGI::Session seems more recently maintained, as opposed to the 2001 last update for Apache::Session. Also, CGI::Session seems to have nice support for automatic expiration, etc.

What are your experiences with Sessions and mod_perl? Anyone know what some of the best options are for this?

Looking forward to yer thoughts...
-Alex

Replies are listed 'Best First'.
Re: Apache::Session vs. CGI::Session
by PodMaster (Abbot) on Apr 12, 2003 at 02:19 UTC
    I'd choose CGI::Session just because Apache::Session isn't being maintained anymore, and the last version doesn't fare so well (see cpan testers reports, and the outstanding bugs list).

    update: That's not maintenance perrin ;)


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      Apache::Session is maintained. Jeffrey rarely puts out new patches, but he's still around, and we all pitch in to help support it on the mod_perl list.
Re: Apache::Session vs. CGI::Session
by adrianh (Chancellor) on Apr 12, 2003 at 23:11 UTC