in reply to print and redirect

The fact that your Location ends up in the browser is because you somehow already closed the HTTP header (the double \n closes it)... Make sure you close it when you intend to close it :))
To answer your second question:

Set-cookie: Cookie=Chocolate crisps\n"; Location: http://www.perlmonks.com\n\n"; # Closed now !
Should work fine... Ofcourse you could use CGI.pm as mentioned above

Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.

Replies are listed 'Best First'.
Re: Re: print and redirect
by costas (Scribe) on Apr 10, 2001 at 18:57 UTC
    This works fine,

    However is it better coding practise for me to write the following?

    <html> <head> <meta http-equiv="refresh" content="0;url=http://redirect.url.here?any cgi=options&here=too"> </head> <body></body> </html>

    rather than just the meta refresh line

      In general I would say no, avoid http-equiv headers if you can modify the real http headers.

      However, it depends why you are redirecting, using http-equiv headers gives you the ability to include javascript etc. Using the 'real' http headers gives proxies a better chance of understanding what you're doing, and theoretically they could read the http header and prepare the redirect before the browser asked for it. I have no idea if this actually happens.

      I beleive that the w3 position is to avoid http-equiv headers.

      (Did I understand your question correctly??)
        Yes you understood fine, I will now try to include the redirect and cookie in the HTTP header itself