print $cgi->redirect('http://www.perlmonks.com');
Of course.
/J\ | [reply] [d/l] |
Uhm I thought this was a non-profit thing here. ;-)
print $cgi->redirect("http://www.perlmonks.ORG")
| [reply] [d/l] |
They should both work. Did you try?
| [reply] |
Another comment, please remember that you can't print the header previously. In other words, this may give you problems:
print "Set-Cookie: $newcookie=$value; path=$path; expires=$time\n";
print $query->redirect('http://www.perlmonks.org/');
Here's a way around that problem:
print $query->redirect('http://www.perlmonks.org/', -cookie => $newcoo
+kie);
Good luck.
—Brad "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
| [reply] [d/l] [select] |
You don't have to use the CGI module for everything.
I personally use it only for parsing of the cgi parameters,
but rarely for forming a response.
print "Status: 302 Found\n",
"Location: http://www.perlmonks.com/\n\n";
| [reply] [d/l] |
localhost:~ % perl -MCGI=redirect -e 'print redirect("/somewhere")' |
+od -c
0000000 S t a t u s : 3 0 2 M o v
+ e
0000020 d \r \n L o c a t i o n : / s
+ o
0000040 m e w h e r e \r \n \r \n
+
0000053
| [reply] [d/l] [select] |
Yes, you are right. It would only work as a CGI.
However, the browser has to convert the Status-header to a
http status line (such as "HTTP/1.1 302 Found\cm\cj"), as Status is CGI-specific.
I don't know how these lightweight servers you mention work,
but I suppose either they or the CGI module would
have to issue a status line anyway.
| [reply] [d/l] |