Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Stumped on using CGI.pm cookie method
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 =----

Report this thread to moderator Post Follow-up to this message
Old Post
Don
04-25-05 01:56 AM


Re: Stumped on using CGI.pm cookie method
Don <> 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

Report this thread to moderator Post Follow-up to this message
Old Post
Tad McClellan
04-25-05 08:58 AM


Re: Stumped on using CGI.pm cookie method
On 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 =----

Report this thread to moderator Post Follow-up to this message
Old Post
Don
04-25-05 08:58 AM


Re: Stumped on using CGI.pm cookie method
Don <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

Report this thread to moderator Post Follow-up to this message
Old Post
Tad McClellan
04-25-05 08:58 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Miscellaneous archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:28 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.