Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Rose::DB::Object and CGI::Session

by cLive ;-) (Prior)
on Oct 02, 2008 at 16:22 UTC ( #715043=perlquestion: print w/replies, xml ) Need Help??
cLive ;-) has asked for the wisdom of the Perl Monks concerning the following question:

I think my biggest problem here is trying to work out where I should be looking...

I'm adding a Rose::DB::Object (subclassed in RoseDbObject, say) and wrapped in a Manager class to a CGI Session object:

$self->session->param( user => RoseDbObject::Manager::userLoad($userna +me) );

This works, but when I end the CGI instance, the user param gets set to undef. So, on the next instance of this session, $self->session->param('user') doesn't exist as expected.

I'm guessing that there's some automatic cleanup running in Rose::DB::Object subclass (it probably is a bad idea to keep a Rose DB object persistent in a session, but since I was using it as read only... ;-), but nothing jumps out at me during a quick scan of the code.

Anybody got a clue as to whether

  1. Rose DB is undef'ing it (sensibly);
  2. CGI::Session is not freezing it; or
  3. I'm missing a different stupid error

Yes I'm being lazy - I don't want to try to write a standalone case outside of the app unless I have too. I guess I will if I have to, but I was hoping someone might have a hint or two as to what I'm missing first :)

Any ideas as to what I'm missing?

Replies are listed 'Best First'.
Re: Rose::DB::Object and CGI::Session
by perrin (Chancellor) on Oct 02, 2008 at 17:06 UTC
    You could ask on the Rose mailing list, but my general advice is to avoid putting objects in your session. You should keep session data as small as possible because it gets sent to and from your database and passed through Storable on every hit. If you just save a unique ID instead, it will be much smaller.
      Agreed. It's info needed on each request, but I think I can drop my new found obsession with Rose DB here and just store the needed info in a hashref in the session.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://715043]
Approved by moritz
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2018-05-20 14:08 GMT
Find Nodes?
    Voting Booth?