CGI-Session - Saving Array Reference in session->param.

Posted on Mon Feb 26 19:50:00 2007 by bigj26
Saving Array Reference in session->param.
Hi, hopefully somebody might help me. I am debugging a code, which actually had worked before with an older CGI-SESSION version. I have just one question, where I don't find an answer for in the books I borrowed. I have 2 subroutines: Nr.1:
sub 1{ my @selectedkeys = ('bla', 'blub'); $session->param('selectedkeys' => \@selectedkeys); }
Nr.2:
sub 2{ my $output = $session->param('selectedkeys'); print @$output }
So in Subroutine 1, an array is created and filled with information. Then the address of the reference is passed to
$session->params
. When I use sub2 now, and looking at the address, it differs from the address I got in subroutine 1. Also the dereferencing via
@$output
is empty. My question is, if PERL destroys the
my @selectedkeys Array
, after subroutine 1 is finished and if that is why the derefence is empty? Hopefully somebody might be able to help me. Thank you very much.
Write a response