[thelist] redirecting in perl

Jeremy Marx devnull at subject2change.com
Thu Aug 2 18:07:46 CDT 2001


At 04:58 PM 8/2/01, you wrote:
>hello evolters,
>i was just wondering how i can redirect in perl after I've
>set a cookie because to set the cookie i us
>
>print "Content-type: text/html\n";
>print "Set-Cookie: information=$set_value; expires=$set_expires; path=\n\n";

Put the second newline(\n) after the redirection. Two newlines in a 
row(which is essentially a blank line..) signals the end of the headers. 
Both your cookies and your relocation need to be in that header. So, save 
the blank line for after the redirect. Also make sure the redirection is 
the last thing in the header. Here's a sample:

print "Content-type: text/html\n";
print "Set-Cookie: information=$set_value; expires=$set_expires; path=\n";
my $place = "http://localhost/".$redir;
print "Location: $place\n\n";

.jeremy.





More information about the thelist mailing list