You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ian Mahuron <ia...@dmi.net> on 2000/06/05 17:08:53 UTC

Object persistence

Is there any way to implement object persistence with Apache::Session?

I'd like to do something like this (though I'm not sure how):

# during some point in application (throwing object into session data)

my $user = MyMods::User->new();
$user->fetch_by_id(1234);
$session{user} = $user;


# during some other request (pulling object out)

my $user = $session{user};
my $login = $user->login();
print("$login\n");

I'm sure it's more complicated then this.  Any help would be appreciated.
Thank you in advance.

Ian


Re: Object persistence

Posted by Gunther Birznieks <gu...@extropia.com>.
I think the answer is yes if you are talking about a straight object data 
structure. But no if you are talking about persistence of things like 
socket or database connections that might be open resources that are 
represented by your user object.

Apache::Session uses storable to serialize the objects into session's data 
store.

Later,
    Gunther

At 08:08 AM 6/5/00 -0700, Ian Mahuron wrote:

>Is there any way to implement object persistence with Apache::Session?
>
>I'd like to do something like this (though I'm not sure how):
>
># during some point in application (throwing object into session data)
>
>my $user = MyMods::User->new();
>$user->fetch_by_id(1234);
>$session{user} = $user;
>
>
># during some other request (pulling object out)
>
>my $user = $session{user};
>my $login = $user->login();
>print("$login\n");
>
>I'm sure it's more complicated then this.  Any help would be appreciated.
>Thank you in advance.
>
>Ian