You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jeff <ja...@aquabolt.com> on 2002/05/08 11:02:36 UTC
RE: Perrenial Sessions: -> Perrin-ial sessions
Muchas gracias for the advice - this makes mucho sentido.
I will call my class Perrin-ial Sessions in Harkins homage 8-)
Thanks a gin!
-----Original Message-----
From: Perrin Harkins [mailto:perrin@elem.com]
Sent: 07 May 2002 23:15
To: Jeff
Cc: modperl@perl.apache.org
Subject: Re: Perrenial Sessions: An Object Interface?
Jeff wrote:
> All the e dot gee's that I can find, perldoc and guide pages show
> sessions being used with a tied old hash interface - I was wondering
if
> there is an new style object interface?
I don't actually see anything in your example that is more OO than the
existing Apache::Session interface. However, if you don't want to use
the tied interface you can always access methods like STORE and FETCH
directly. Those methods are the tied hash interface and are safe to
use. It's actually faster to call them directly than to use the tied
interface.
Personally, I've always made my own session wrapper class that called
these methods as needed. I don't want a generic session interface in
most of my applications, but rather a very specific one with methods
like $session->is_logged_in() or $session->user(). This gives me a
place to put the logic for timing-out sessions and managing what happens
when a session isn't found. It also prevents problems with typos in
session keys, since the session key names are all encapsulated in my
custom session class.
- Perrin