-
Perl Redirects
/I keep trying to get into perl./& It is difficult for me to pick up\/ after using php.|Anywho... i'm trying to do a page redirect and have been unsuccessful.> I'm using ActivePerl/XP Pro and have the following line:
Code:
print "Location:$url";
The browser thinks for awhile and then timesout or displays the line "Location:index.htm" (that being the url) on the page. Everything else i've done seems to work okay.
-
I think you're forgetting the 2 newline characters which are required after an HTTP header:
And if you're coming from PHP => Perl, you might find this resource extreemly helpful:
http://www.cs.wcupa.edu/~rkline/csc417/Perl2Php/
-
No dice... could it be because i'm using ActivePerl on WinXP? Sup wit that... using:
Code:
print "Location: ../main.htm\n\n";last
I get
Quote:
Location: ../main.htm
once the script is run. I've also tried 'http://localhost/main.htm' without success. ARG!
-
Yeah - sounds like a Perl configuration issue. Exactly what did you setup as the path to Perl in the IIS extension mappings? What is the query string you're passing it?
-
I figured it out... i had already printed the content-type as html/text. I take it that since i was printing to the header, I shouldn't be printing that unless i want to print html instead. This perl business is so crazy! Once again, thank you Grizzly for your informative help.
-
Perl is just pure low-level scripting -- you have to output your own headers, unlike PHP that does it for you because it is a high-level web scripting language (Perl wasn't originally designed for the web).
You should probably also print out 'HTTP/1.0 302' for the status, since some browsers don't like just 'Location: [url]'.