in reply to Re^8: Sessions Questions
in thread Sessions Questions

Disclaimer: haven't read or tried to follow the whole thread.

$query{$sessionname} is trying to access the value of a key in %query, which is not defined in the scope.

Maybe you meant $query->{ $sessionname } which accesses the value of a key in the hashref $query.

But that won't work either since what you seem to be actually trying to access is the object in $query, not a hashref nor a hash of the same name. See the next line where you correctly access the value returned by $query's object method param() with an argument of $sessionname.

There are other questionable things in this code, for example elsif(scalar$query) -- this is unnecessary (you must have done my $query = CGI->new ... somewhere above, right?) and calling scalar() on a scalar is meaningless.

I don't know whether you wrote all this, or copied it from somewhere, or assembled it from things you've found in various places, but it's a mess, and that's obvious without reading the start of this thread. You badly need to read -- and understand -- quite a bit of documentation. See the Perl Data Structures Cookbook, CGI, for starters.

Also, since you have chosen the CGI route, review Ovid's CGI Course - Resurrected and Updated!

And as more generalized friendly suggestions I offer: (1) Dump your IDEs and learn to write Perl code on the command line and in plain text files. (2) Set up a webserver on your local machine so you can test your code locally and don't have to worry about "uploading" and "downloading" anything until it works.

Hope this helps!


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^10: Sessions Questions
by huck (Prior) on Mar 05, 2017 at 18:53 UTC