Code Comments
Programming Forum and web based access to our favorite programming groups.I'm trying to implement a test on the values of two cookies using the CGI.pm
approach to cookies. But, I'm getting the following error that's got me
stumped. I'm real new to Perl, and am doing my best to figure this out. I
sure could use some help with this. Thanks much. -- Don
Error messages in server log:
"Useless use of a constant in void context at wwwboard.pl line 110. Useless
use of a constant in void context at wwwboard.pl line 103"
Note: line 103 is the opening brace on the "if" statement. And, line 110
is the first line of the "eval" statement.
Start of code:
----------------------
# Check to see if client has logged in and passed Username/Password
test.
#
my $query = new CGI;
if(value=>[$query->cookie(-name=>'cpceLoggedInCookie')] ne 'true' or
value=>[$query->cookie(-name=>'cpceUsernamePasswordPassedCookie')] ne
'true')
{
# HTML code to be inserted here.
exit;
}
# Done with login test.
eval {
sub SEEK_SET() { 0; }
} unless defined(&SEEK_SET);
----------------------
End of code
----== Posted via mcse.ms - Unlimited-Uncensored-Secure Usenet News==-
---
http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+ New
sgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Post Follow-up to this messageDon <> wrote:
Please choose one posting address and stick with it.
Thank you.
> I'm trying to implement a test on the values of two cookies using the CGI.pm[/colo
r]
Why don't you just copy/paste the sample code given in the module's
documentation and then modify it for your situation?
> Error messages in server log:
> "Useless use of a constant in void context at wwwboard.pl line 110. Useles
s
> use of a constant in void context at wwwboard.pl line 103"
>
> Note: line 103 is the opening brace on the "if" statement. And, line 110
> is the first line of the "eval" statement.
If you copy/pasted the code you included into a complete program,
then the line numbers would be easier to count "by eye".
Have you seen the Posting Guidelines that are posted here frequently?
> my $query = new CGI;
> if(value=>[$query->cookie(-name=>'cpceLoggedInCookie')] ne 'true' or
That is kind of bizarre, and I wonder why you think it would work.
What did you read that made you think you could do it that way?
It is the same as:
if('value',[$query->cookie(-name=>'cpceLoggedInCookie')] ...
^ ^^
^ ^^
You have put a list into the (boolean) if-clause.
And you are comparing a *reference* to the string "true", that
comparison will always be false, making it into a useless test.
CGI.pm docs give this code:
$riddle = $query->cookie('riddle_name');
So for your situation it would be:
$riddle = $query->cookie('cpceLoggedInCookie');
Then plug it into an if-clause:
if ( $query->cookie('cpceLoggedInCookie') ne 'true' ...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
Post Follow-up to this messageOn Sun, 24 Apr 2005 19:50:45 -0500, Tad McClellan <tadmc@augustmail.com>
wrote:
>Don <> wrote:
>
>
>Please choose one posting address and stick with it.
>
>Thank you.
>
>
>
>
>Why don't you just copy/paste the sample code given in the module's
>documentation and then modify it for your situation?
>
>
>
>
>If you copy/pasted the code you included into a complete program,
>then the line numbers would be easier to count "by eye".
>
>Have you seen the Posting Guidelines that are posted here frequently?
>
>
>
>
>That is kind of bizarre, and I wonder why you think it would work.
>
>What did you read that made you think you could do it that way?
>
>
>It is the same as:
>
> if('value',[$query->cookie(-name=>'cpceLoggedInCookie')] ...
> ^ ^^
> ^ ^^
>
>You have put a list into the (boolean) if-clause.
>
>And you are comparing a *reference* to the string "true", that
>comparison will always be false, making it into a useless test.
>
>CGI.pm docs give this code:
>
> $riddle = $query->cookie('riddle_name');
>
>So for your situation it would be:
>
> $riddle = $query->cookie('cpceLoggedInCookie');
>
>Then plug it into an if-clause:
>
> if ( $query->cookie('cpceLoggedInCookie') ne 'true' ...
Thanks for your help.
Don
----== Posted via mcse.ms - Unlimited-Uncensored-Secure Usenet News==-
---
http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+ New
sgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Post Follow-up to this messageDon <no@adr.com> wrote: > On Sun, 24 Apr 2005 19:50:45 -0500, Tad McClellan <tadmc@augustmail.com> > wrote: > So is "no@adr.com" going to be the one? Do you really own or work for adr.com? It isn't nice to use other's names without permission... Have you done that yet? > Thanks for your help. If you really mean that, then please learn how to compose a proper followup. Soon. -- Tad McClellan SGML consulting tadmc@augustmail.com Perl programming Fort Worth, Texas
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.