develooper Front page | perl.beginners | Postings from March 2002

Re: Cookies, What's wrong with this?

Thread Previous
From:
Johannes Franken
Date:
March 3, 2002 08:06
Subject:
Re: Cookies, What's wrong with this?
Message ID:
20020303170626.B3263@jfranken.de
On Sun, Mar 03, 2002 at 07:20:35AM -0500, Motherofperls@aol.com wrote:
> Could someone tell me why this doesn't retrieve my cookie?
> use CGI param, header,cookie;
> print header();
> print header(-cookie=>'MY_COOKIE');

header() is for generating an http header, not for reading from it.
print cookie('MY_COOKIE') instead.

Quoting the CGI manpage:

	To retrieve a cookie, request it by name by calling
	cookie() method without the -value parameter:

	use CGI;
	$query = new CGI;
	%answers = $query->cookie(-name=>'answers');
	# $query->cookie('answers') will work too!
	
-- 
Johannes Franken
 
Professional unix/network development
mailto:jfranken@jfranken.de
http://www.jfranken.de/

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About