Hi,

I have tried the following script under Windows 2000, mod_perl 2, Perl
5.8.4:

use strict;
use CGI;

my $q = new CGI;

print "Content-type: text/html\n\nTestare\n";
$q->redirect("http://localhost/";);

This should print the Content-type: text/html header, then the word
"testare" in the body, then the word "Location: http://localhost/";, but it
doesn't happen this way.

The page is redirected to http://localhost/ and after the redirection
header, "Content-type: text/html" followed by "testare" are still printed.

I think this may have something to do with the fact that CGI.pm is loaded
before anything by mod_perl, and who knows why, the method $q->redirect() is
used before other print statements.

Please tell me how can I avoid this, and print the headers in order?

Thank you.

PS. I have seen that if I use print "Location: http://localhost/\n\n";;
instead of using the CGI method, it doesn't happen what I said.

Teddy

Reply via email to