CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
cannot read cookie

 



puckpuck
New User

Mar 10, 2006, 9:53 PM

Post #1 of 3 (377 views)
cannot read cookie Can't Post

Hi all,

one of my app is setting a cookie. I use the following code to read the cookie. it runs fine when the code is hosted on a unix box. but when I host it on a windows machine, it fails reading the cookie. it is quite irritating for me now. any help is appreciated.

---------
#!c:/perl/bin/perl.exe

print "Content-type:text/html\n\n";

# Modules used
use CGI;
# Create an object of CGI
$query = new CGI;
# Request the cookie set by the application MYCOOKIE
$theCookie = $query->cookie('MYCOOKIE');


print "<b>$theCookie";
---------------


KevinR
Veteran


Mar 10, 2006, 10:29 PM

Post #2 of 3 (376 views)
Re: [puckpuck] cannot read cookie [In reply to] Can't Post

I think you should get the cookie before printing the http header:


Code
#!c:/perl/bin/perl.exe 

use CGI;
$query = new CGI;
$theCookie = $query->cookie('MYCOOKIE');

print $query->header;
print "<b>$theCookie";

-------------------------------------------------


puckpuck
New User

Mar 10, 2006, 10:31 PM

Post #3 of 3 (375 views)
Re: [KevinR] cannot read cookie [In reply to] Can't Post

I got it working. I used the FQDN in the URL to call the script. and for some reason its working now. thanks anyway.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives