Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

CGI::Session reloading

by gwhite (Friar)
on Oct 20, 2008 at 12:56 UTC ( #718212=perlquestion: print w/replies, xml ) Need Help??
gwhite has asked for the wisdom of the Perl Monks concerning the following question:

I am self taught so sometimes I just don't get what the doc is saying if it gets over my head. I am trying to use CGI::Session, I have an 8 page input form, but during the loading of form page 5 I need several of the variables from previous pages to determine what questions should be shown, and at the end I need everything pulled in to process. I would like to use something along the lines of the CGI command param(), where I can on one line just load a hash with all the values stored in the session. Is that possible? Here is how I use CGI:

my $input = new CGI(); my %hash = map { $_, $input->param($_) } $input->param();
All the examples in CGI::Session::Tutorial load a specific value, no examples just slurping in everything. So with CGI::Session I have tried to do a load_param() like this and it doesn't seem to take.
$session = CGI::Session->load() or die CGI::Session->errstr; $input = $session->load_param(); # $input is my existing cgi object my %hash = map { $_, $input->param($_) } $input->param();
What do I need to get all my session variables loaded into a hash?

g_White

Replies are listed 'Best First'.
Re: CGI::Session reloading
by moritz (Cardinal) on Oct 20, 2008 at 13:04 UTC
    It seems you need my $d = $session->dataref, which returns a hash reference. Calling keys %$d on that one gives you the list of all session keys.

      OK, got it, thanks.

      g_White

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://718212]
Approved by Corion
help
Chatterbox?
[marioroy]: Hi Discipulus. Super Discipulus++.
[Tanktalus]: Wow, given the time separation of marioroy's oatmeal cookies and Disciplulus' response, I'm amazed that marioroy responded :)
[Discipulus]: no no seriously, redss posed a good question in the right moment, and you gave as always wonderful answers
[Discipulus]: Tanktalus my comment was about how to fork & join in tk?
[marioroy]: Oh, I've might of missed Discipulus's earlier response. I had gone to bed.
[Tanktalus]: ah, I don't even have the perlmonks site open in my browser :)
Tanktalus is chatting through his cbstats application :)
[marioroy]: Perl is so much fun.

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2017-04-23 19:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.