You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by c....@pobox.com on 2002/05/21 22:16:53 UTC

Storing blessed objects via Apache::Session

I was attempting to store a blessed object via Apache::Session, but
when the session is returned, the hash is empty.  I did some google
searching and ran across a similar question:

http://www.geocrawler.com/archives/3/182/2000/5/0/3823715/

I have not found any other information, and was curious if there was
something special that had to be done for this to work?

Any and all help would be most appreciated!

I have the latest Apache::Session-1.54.

-- 
C Wayne Huling <c....@pobox.com>

Re: Storing blessed objects via Apache::Session

Posted by Chris Winters <ch...@cwinters.com>.
On Tue, 2002-05-21 at 19:19, c.w.huling@pobox.com wrote:
> Chris Winters writes:
> > Nothing special should be required -- I've done this with no problem
> > using recent versions -- 1.50+ -- of Apache::Session. The only way it
> > might be a problem is if you're trying to save a "special" resource in
> > the session -- database handle, socket connection, etc.
> > 
> > Are you sure basic sessions are working ok?
> 
> Yes, the basic functions work, but I do have a DBH inside the object.  

That might be it. To test just do something like:

 $session{foo} = bless( { hey => 'there' }, 'My::Class' );

save it, fetch it and see what happens when you do a 'ref
$session{foo}'.

You might want to either rethink having the database handle in the
object -- retrieving it from a common central location, for instance --
or create a simple function to copy the object without database handle
and set it into the session.

Chris

-- 
Chris Winters (chris@cwinters.com)
Building enterprise-capable snack solutions since 1988.


Re: Storing blessed objects via Apache::Session

Posted by Chris Winters <ch...@cwinters.com>.
On Tue, 2002-05-21 at 16:16, c.w.huling@pobox.com wrote:
> I was attempting to store a blessed object via Apache::Session, but
> when the session is returned, the hash is empty.  I did some google
> searching and ran across a similar question:
> 
> http://www.geocrawler.com/archives/3/182/2000/5/0/3823715/
> 
> I have not found any other information, and was curious if there was
> something special that had to be done for this to work?
> 
> Any and all help would be most appreciated!
> 
> I have the latest Apache::Session-1.54.

Nothing special should be required -- I've done this with no problem
using recent versions -- 1.50+ -- of Apache::Session. The only way it
might be a problem is if you're trying to save a "special" resource in
the session -- database handle, socket connection, etc.

Are you sure basic sessions are working ok?

Chris

-- 
Chris Winters (chris@cwinters.com)
Building enterprise-capable snack solutions since 1988.