Click to See Complete Forum and Search --> : Store objects in sessionvariable


digital_storm
05-16-2005, 10:52 AM
Hello

I have been able to store and retrieve sessionvariable of type String using CGI::Session
but there will be alot of variables so I thought it would be nicer to store all variables in an object and store the object in an sessionvariable....but I have had some problems with this...

Lets say I have an object called Person with some variables and some methods....
I have tried to do like this to store the object: $session->param('person',$currentpers) and this to retrieve the object: $mypersoncopy=$session('person')

but it doesn't work....I have read that you shouldnt use references when you store objects so I store the original (as I know with my little knowledge og Perl)
when I call on a method in $mypersoncopy (that I know exist in my class that I have made an object from) like $mypersoncopy->getid(); it is just printing out '->getid()' and not the value of current object

What should I do to make this work?


Thanks in advance!

/D_S