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:
Perl & CGI cookies -

 



pharron
Deleted

Jan 29, 2001, 11:41 PM

Post #1 of 2 (127 views)
Perl & CGI cookies - Can't Post

Hi,

I'm using Perl & CGI to set some cookies (print header(-cookie => $cookie);). After I set the cookies I want to do a print "Location: ...etc", but instead of actually going to the URL it prints the URL in the Browser..

Do i need to change the header type ???

I've attached a sample script..

Thanx
use CGI qw(:all);
use strict;
use CGI::Carp qw(fatalsToBrowser);

my $cookie=cookie(-name =>'Sample', -value => 'This cookie contains no message', -expires => '+8d');

print header(-cookie => $cookie);

print "Location: http://www.bbc.co.uk\n\n";




Jasmine
Administrator / Moderator

Jan 30, 2001, 9:23 AM

Post #2 of 2 (122 views)
Re: Perl & CGI cookies - [In reply to] Can't Post

The header() call already outputs the content-type part, so you may want to try the redirect function:

print $q->redirect(-location=>'http://whatever.com');


 
 


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

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