[CDBI] Class::DBI and Apache::Session - Why does it work?

[prev] [thread] [next] [Date index for 2005/12/02]

From: Brian Gorby
Subject: [CDBI] Class::DBI and Apache::Session - Why does it work?
Date: 21:31 on 02 Dec 2005
I'm trying to understand exactly how the following (simplified) scenario 
works in a mod_perl web application:

I've mapped a User table to a User entity class which subclasses 
Class::DBI::MySQL. In the web application, I define

$user = User->retrieve();

And then save $user in a session object, which is also stored in a MySQL 
table.

%my_session{my_user} = $user;

I then restart both Apache and MySQL. The session is restored, and I 
pull back out $user

$user = %my_session{my_user};

I can then make any updates I wish to $user. But why? I thought all I 
persisted was a reference to some memory that would've gotten destroyed 
upon restarting of servers.

Now what's even more interesting is, if I then have a foreign key in 
$user, and I manually delete the row that's referenced by $user (so that 
$user logically no longer lives in the database), I can still access 
foreign key objects like $user->address(), and update them as I please - 
even upon successive server restarts.

Any insight as to why this works would be appreciated.

Thanks,

-Brian


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

(message missing)

[CDBI] Class::DBI and Apache::Session - Why does it work?
Brian Gorby 21:31 on 02 Dec 2005

Generated at 11:26 on 05 Dec 2005 by mariachi v0.52