472,973 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,973 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 2045
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...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.