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

Thanks for timely response. "as you see debugging by proxy can be a real pain, even more so for me when you only release code in little pieces, spread across many threads. I understand your frustration, do you understand mine?"

I totally understand your frustration. Repeated warning say not to post lots of code. So the snippets.

Last first:

as to why "the warn( in my cgi scripts do not print in the error log" i cannot answer, mine do, and a google search has produced no further answers either.

I searched everywhere also and found nothing that matched my problem. At a loss.

On the first part, I had already tried my ($query) = @_;

and got

Sun Mar 5 07:51:35 2017 -: Global symbol "%query" requires explicit package name at - line 225, <DATA> line 998. Sun Mar 5 07:51:35 2017 -: BEGIN not safe after errors--compilation aborted at - line 646, <DATA> line 998.

Shows in syntax check in Padre. This I totally don't understand as the syntax check is still finding "global symbol "%query" somewhere.

I shut Padre down. Reopened and still there. Again did search on %query and nothing.

Ran a debug and still there:

Status: 500 Content-type: text/html

Software error:

Global symbol "%query" requires explicit package name at manageus
ers.pm line 226, <DATA> line 998.
BEGIN not safe after errors--compilation aborted at manageusers.pm line 647, <
;DATA> line 998.


This error does not show up in komodo syntax check. 

Replies are listed 'Best First'.
Re^7: Sessions Questions
by 1nickt (Canon) on Mar 05, 2017 at 14:16 UTC

    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.

      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.