473,405 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

cgi / cookie help

Joe
I want to be able to detect if I can write cookies out or not.

Currently I'm doing:

my $cgi = new CGI;

my $cookie = $cgi->cookie(-name => $POLL_CODE_TEST,
-value => "cookietest",
-expires => "1d",
-path => '/',
-domain => $COOKIE_REALM);

print $cgi->cookie($POLL_CODE_TEST);

Now this doesn't work. Even when you can write out cookies,
$cgi->cookie($POLL_CODE_TEST) doesn't give me it back. Now I'm
guessing that the CGI object doesn't acturally write out the cookies
until it's destructor... So I tried it in a different scope but that
didn't work. Maybe I don't understand perl scope, which is very
possible.
What am I missing, and is there a better way to test you can write out
cookies?

Thankyou for anyhelp.
Jul 19 '05 #1
1 2076
In article <65**************************@posting.google.com >, Joe
<ja*****@www.com> wrote:
I want to be able to detect if I can write cookies out or not.

Currently I'm doing:

my $cgi = new CGI;

my $cookie = $cgi->cookie(-name => $POLL_CODE_TEST,
-value => "cookietest",
-expires => "1d",
-path => '/',
-domain => $COOKIE_REALM);

print $cgi->cookie($POLL_CODE_TEST);

Now this doesn't work. Even when you can write out cookies,
$cgi->cookie($POLL_CODE_TEST) doesn't give me it back. Now I'm
guessing that the CGI object doesn't acturally write out the cookies
until it's destructor... So I tried it in a different scope but that
didn't work. Maybe I don't understand perl scope, which is very
possible.
What am I missing, and is there a better way to test you can write out
cookies?
Cookies are printed to standard output with the header, i.e. when you
do:

print $cgi->header(-cookie=>$cookie);

If you want to see what you are sending to the client, do

print $cookie,"\n";

You can always write out cookies in the header. Whether or not the
client accepts them and sends them back with subsequent queries is
something else. You have to check $cgi->cookie("$POLL_CODE_TEST") in
the next query in your example to see if you get back what was sent.

Thankyou for anyhelp.

FYI: this newsgroup is defunct. Try comp.lang.perl.misc in the future.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ajay | last post by:
hi! i am printing a simple cookie, but instead of printing um=name:blah&access:admin&exp:2312390.909 its printing um="name:blah&access:admin&exp:2312390.909" why the quotes?
5
by: AHN | last post by:
Please tell me somebody what causes the cookie set with <% Response.Cookies("blah") = "Blah blah" Response.Cookies("blah").Expires = DateAdd( "h", 1, Now() ) %> work as supposed on my local...
1
by: koen colen | last post by:
Hello group, I hope you guys can help me out, I am modifying a piece of code from Joe Norman, I did found the code here: http://www.intranet2internet.com/public/default.asp?PAGE=sscript&ID=3 ...
12
by: Jason Shohet | last post by:
I've asked this on the asp ng, but couldn't get any advice, wondering if anyone here can help... GOAL: place a .NET cookie, in a user's cookie folder, containing the machinename of the current...
3
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code...
0
by: Alan Silver | last post by:
Hello, I am having a problem setting and resetting cookies. I'm sure I just doing something really stupid as this is such a basic issue, but I can find any answer. Please can someone help me? ...
1
by: CR1 | last post by:
I found a great cookie script below, but don't know how to make it also pass the values sent to the cookie, to a querystring as well for tracking purposes. Can anyone help? If there was a way to...
6
by: kelvlam | last post by:
Hello all, I'm still a bit new with JavaScript, and I hope the guru here can shed some light for me. It's regarding handling cookie and the case-sensitive nature of JavaScript itself. My...
5
by: mosscliffe | last post by:
I have the following code, which I thought would create a cookie, if one did not exist and on the html form being sent to the server, it would be availabe for interrogation, when the script is run...
16
by: Stevo | last post by:
I'm guessing this is a laughably obvious answer to many here, but it's not to me (and I don't have a server or any knowledge of PHP to be able to try it). It's not strictly a PHP question, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.