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: Beginner:
2 headers

 



pu_nk
journeyman

Nov 17, 2001, 8:01 PM

Post #1 of 2 (589 views)
2 headers Can't Post

I am looking for a way to use 2 headers uing CGI.pm
I want to set a cookie and at the same time redirect the webpage somewhere else.. any way to do this ?
Is there another way i can write to set the cookie without using
print header(-cookie=> $cookie);
------------------------------------------------------------------
HERE IS WHAT I NEED TO DO


#!/usr/bin/perl
use CGI qw(:standard);

$viz = "1";
$cookie = cookie(-name=>'visits', -value=>$viz, -expires=>'+1d', -path=>'/');

print header(-cookie=> $cookie);
print redirect("http://www.cool.com");
---------------------------------------------------------------

drew



wog
stranger

Nov 21, 2001, 5:29 PM

Post #2 of 2 (569 views)
Re: 2 headers [In reply to] Can't Post

CGI.pm's redirect function accepts a -cookie argument like the header function does:

Code
# ... 
print redirect("http://www.cool.com/",-cookie=>$cookie);
# ...


 
 


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

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