cgi.pm cookie function - am I missing something? 
Author Message
 cgi.pm cookie function - am I missing something?

Hi,

I'm running into some issues while using cgi.pm and I'm hoping someone
here can point me in the right direction.

My script is like a mini-shopping cart where users can add items and
they are stored via cookie. It doesn't actually process payments, just
keeps track of stuff in a cookie called CoStore.

At the beginning of the script, I check to see if a cookie already
exists like:

%userorders     =       cookie('CoStore');

If a user is adding (or deleting) a transaction from their order, I
change the value of the %userorders hash appropriately (or setup a new
%userorders hash if there wasn't any returned from the cookie
function), and save the cookie like:

$cookie=cookie(-name=>'CoStore',
                -value=>\%userorders,
                -path=>'/',
                -expires=>'+7D');
                print header(-cookie=>[$cookie]);

It appears that the cookie successfully sets.  In fact, I can go and
see it in the cookies files used for IE and Netscape.

However, even with the cookie there and visible to me in text, the
first use of the cookie function to set %userorders never ever returns
the cookie.

What's also wierd, is that another script on my site sets a different
cookie with a different name, and if in my script I check for that
cookie like:
%userorders = cookie('U_Forms');
it finds that cookie OK.

So I'm stumped as to why it finds that one and not the other one.

My IE cookie file actually shows the following:

U_Forms
req_name&Jennifer[snipped values]
[snipped domain]/
0
471652480
29472745
1131420640
29436535
*
CoStore
1&1%7C1%7CS
[snipped domain]/
0
2310258304
29439526
1820898304
29439526
*

So both cookies are there but not sure why cgi.pm cookies function
cannot find the 'CoStore' one.  I don't think its expired because it
was set for +7D which I think is corect for 7 days in the future.

Any suggestions?

Thanks,

Jennifer



Sun, 22 Feb 2004 17:54:17 GMT  
 cgi.pm cookie function - am I missing something?

(snipped)

Quote:
> It appears that the cookie successfully sets.  In fact, I can go and
> see it in the cookies files used for IE and Netscape.

What is the name of the file for storing Netscape cookies?

Godzilla!



Sun, 22 Feb 2004 18:15:28 GMT  
 cgi.pm cookie function - am I missing something?

Quote:

> So both cookies are there but not sure why cgi.pm cookies function
> cannot find the 'CoStore' one.  I don't think its expired because it
> was set for +7D which I think is corect for 7 days in the future.

It is actually called CGI.pm (unless your OS is case insensitive) and if
you read 'perldoc CGI' you would see that 'd' is for days.  Not sure if
that is case sensitive, but m certainly is (m=minute, M=month).

Not sure if this is your problem, but often upper or lower case does
matter.

--
David Efflandt - All spam is ignored - http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/



Mon, 23 Feb 2004 04:10:06 GMT  
 cgi.pm cookie function - am I missing something?

Quote:


> (snipped)

> > It appears that the cookie successfully sets.  In fact, I can go and
> > see it in the cookies files used for IE and Netscape.

> What is the name of the file for storing Netscape cookies?

On Netscape it is cookies.txt which is in my c:\program
files\netscape\users\myusername\ folder.

On IE it is named for my username at the domain.txt in
c:\winnt\profiles\myusername\cookies\

I'm testing on IE primarily since its for our Intranet and that's our
company standard - although it also needs to work on Netscape.  In my
past experience, cookies are something that generally doesn't suffer
from browser incompatabilities, so hopefully if I can get it working
on the one, it should work on the other...

Thanks,

Jennifer

Quote:

> Godzilla!



Mon, 23 Feb 2004 13:29:44 GMT  
 cgi.pm cookie function - am I missing something?

Quote:


> > So both cookies are there but not sure why cgi.pm cookies function
> > cannot find the 'CoStore' one.  I don't think its expired because it
> > was set for +7D which I think is corect for 7 days in the future.

> It is actually called CGI.pm (unless your OS is case insensitive) and if
> you read 'perldoc CGI' you would see that 'd' is for days.  Not sure if
> that is case sensitive, but m certainly is (m=minute, M=month).

Thanks for the tip on the use of 'd' over 'D.'  I was using the book,
Official Guide to Programming with CGI.pm.  The book example uses 'd'
but for some reason I saw it as 'D'.  Big 'D' for 'Duh' on my part, I
guess.  My early tests changing to 'd' look like that did the trick.

Thanks again!

Jennifer

Quote:
> Not sure if this is your problem, but often upper or lower case does
> matter.



Mon, 23 Feb 2004 13:59:18 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Sorting question: I think I am missing something obvious

2. AM I missing something..

3. Problem with Pack/Unpack - I hope I am missing something here

4. Am I missing something???

5. grid() problem - am I missing something obvious?

6. CGI.pm - what am I doing wrng?

7. Files uploaded with CGI.pm missing last 2 bytes

8. === Calling http:// ....something /something.cgi within another script ===

9. obviously missing something...

10. I'm Missing Something

11. Something I'm missing

12. Am I doing something wrong here ....

 

 
Powered by phpBB® Forum Software