in reply to Re: Using Perl To Redirect To Other Pages
in thread Using Perl To Redirect To Other Pages

Minor point, but this "tip" says not to use META refresh for redirection.

Perhaps
print "Location: http://www.foo.com/\n\n";
is a better "quick-n-dirty"?

Update: Whoops. Fixed code - missed newlines - hat tip: Cody Pendant.

--
Rock is dead. Long live paper and scissors!

Replies are listed 'Best First'.
Re: Re: Re: Using Perl To Redirect To Other Pages
by Cody Pendant (Prior) on Dec 04, 2002 at 01:56 UTC
    print "Location: http://www.foo.com/";

    Doesn't that need a couple of newlines after it to work?
    --

    ($_='jjjuuusssttt annootthheer pppeeerrrlll haaaccckkeer')=~y/a-z//s;print;
Re^3: Using Perl To Redirect To Other Pages
by unrelatedmonk1 (Novice) on Apr 05, 2016 at 16:28 UTC
    The beauty of the simple. Thanks!
Re^3: Using Perl To Redirect To Other Pages
by Anonymous Monk on Nov 19, 2008 at 21:13 UTC
    I agree, Cody. Why do people submit solutions that require others to load the submitters HUGE (favorite) Library of overcoded functions when there is such simple solutions?

      If the question asked for how to use HTTP to redirect, I'd probably think to give the print "Location..." answer but when asked for cgi, even in lowercase, we do tend to think of CGI.pm. Plus, though the print "Loc..." works, it is short on headers. It's fine to do it yourself but doing it right is usually easier through an interface. Even one that is less than ideal.

      ~>perl -MCGI -le 'print CGI::redirect("http://perlmonks.org")' Status: 302 Found Location: http://perlmonks.org
      Because perlmonks isn't HTTP monks; because you didn't want to learn HTTP; because HUGE (favorite) Library of overcoded functions keeps you from having to learn HTTP.