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

Well, what is the content of line 225/226 of manageusers.pm ?

When you say "search on %query", how exactly did you search?


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^8: Sessions Questions
by tultalk (Monk) on Mar 05, 2017 at 15:20 UTC

    I did search within Padre and also in file manager on the directory.

    I just uploaded the manageusers.pm file to my weberver and ran the program and got:

    Software error:

    Global symbol "%query" requires explicit package name at /home/jalamior/www/httpsdocs/cgi-bin/lib/perl/manageusers.pm line 227. Compilation failed in require at manage_users.cgi line 33. BEGIN failed--compilation aborted at manage_users.cgi line 33.

    For help, please send mail to the webmaster (webmaster@jala-mi.org), giving this error message and the time and date of the error.

    I then downloaded the manageusers.pm to make sure the upload was not messed up and searched for %query and term was not found. Very very weird.

    225 #Or, check if valid return from cgi query 226 elsif(scalar$query){ 227 if (exists $query{$sessionname}){ $sid = $query->param($sessionname); warn("ProcessLogin Request SID from Query: '$sid'"); $status = 1; } else{ $sid = undef; $status = 2;

      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.