Re: [Cgi-session-user] Storing/retrieving a hash (element)
Brought to you by:
sherzodr
From: Mark S. <ma...@su...> - 2006-09-09 19:21:49
|
Jonathan Mangin wrote: > Hi all, > > I'm storing a hash (test_time) in the session. > It appears correct, but please tell me if this is wrong. > > $session->param('uid' => $uid, > 'test_time' => {'e1' => $row[9], > 'e2' => $row[10], > 'e3' => $row[11], > 'e4' => $row[12], > 'e5' => $row[13], > 'e6' => $row[14], > 'e7' => $row[15]}); > > The real problem is I can't figure out how to retrieve > any _one_ of the test_time elements. Can someone clue > me in? Hello Jon, The answer is not specific to CGI::Session, but is one of how Perl's data structures work. I recommend this: my $href = $ses->param('test_time'); print $href->{e1}; This may also work: print $ses->param('test_time')->{e1}; But I haven't tested it and find it less clear. Mark -- http://mark.stosberg.com/ |