Gossamer Forum
Home : General : Perl Programming :

Cookie Question

Quote Reply
Cookie Question
Using the GT Library, is there a way to tell if setting a cookie was sucessful?

Code:
my $c = $IN->cookie (-expires => '+6M', -name => 'Cart_ID', -value => $cookies );
print $IN->header ( -cookie => $c );
I'm using cookies for the primary tracking of shopping carts on my shopping cart plugin for LSQL, however I would like to be able to drop back to IP tracking or session tracking if the visitor has cookies turned off or blocked.

Thanks for any comments, help or ideas,

AlexJ


Quote Reply
Re: Cookie Question In reply to
Do you want to "check" to see if users have clients activated??? Or do you want to test whether the cookie codes you've written worked?

If it is the former, user environmental variable conditional statements:

if (!$ENV{'HTTP_COOKIE'}) {
SESSION VARIABLE CODES
}
else {
COOKIE CODES
}

If it is the latter you after...you could try "printing" cookie information in the page as part of the DEBUG information or simply open your Temporary Internet Files folder and open the "cookie" file to see if it was saved properly...probably will want to do testing with both Netscape and IE with the above codes and the ones you posted.

Regards,

Eliot Lee