[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgi-list
Subject:    Re: [CGI] setting cookies using perl (code included)
From:       Kevin Montuori <montuori () usg ! jhancock ! com>
Date:       1998-07-31 17:59:02
[Download RAW message or body]

>>> Jann Linder writes:
  jl> This is how i set a cookie in perl (cos i cannot figure out how
  jl> to set two separate ones...so i set one and parse it out to be
  jl> two values later.)

	nothing wrong with using one cookie, i guess,  but...

  jl> if this is NOT the shortest quickest way, then please educate me.
	
	...why not use the CGI module?  a whole lot more flexible (as
	well as shorter and quicker).

	(almost) from the POD:
	
	[...]
	use CGI;
	my $query = new CGI;
	my $IDcookie = $query->cookie(-name    => 'cookie name',
				      -value   => 'cookie value,
				      -expires => '+90d')	

	my $EGOcookie = $query->cookie(-name    => 'cookie name',
				       -value   => 'cookie value,
				       -expires => '+90d')
    
        print $query->header(-type => 'text/html',
			     -cookie => [$IDcookie, $EGOcookie]);

	[...]

	$value_of_IDcookie = $query->cookie(-name=>'IDcookie');

	[...]

	
cheers,
k.

-- 

kevin montuori            

-----------------------------------------------------------------
For subscription information, http://www.jann.com/

The CGI Tips & Tricks website (and archive of the list) is located
at http://www.jann.com/Perl/

cgi-list is hosted by Summit Communication Design (http://www.summitdesign.net).
-----------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic