Oh, I have forgotten to say something more.

I use Apache under Windows 2000 and perl 5.8.4, but I run the script under
mod_perl 2.

However, I still don't understand how this little program prints a different
header when it is ran by mod_perl...

I have ran it from the command prompt using telnet on port 80, and here is
the result:

GET /scripts/test.pl
Range: bytes=0-200
(I just wanted to print only 200 chars, in order to view the top of the
header).

And here is the result:

HTTP/1.1 302 Moved
Date: Sun, 20 Mar 2005 07:40:25 GMT
Server: Apache/2.0.50 (Win32) PHP/5.0.0 mod_perl/1.99_18 Perl/v5.8.4
Location: http://localhost/
Content-Range: bytes 0-200/461
Content-Length: 201
Connection: close
Content-Type: text/html; charset=iso-8859-1
Content-type: text/html
Testare
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Moved</title>
</head><body>
<h1>Moved</h1>
<p>The document h
as moved <a href="http://localhos
Connection to host lost.
C:\Documents and Settings\teddy>

Well, seems that the Location: header is prefered by mod_perl but it also
prints the Content-type: text/html header, and the body content ("testare").

Pretty strange.

Thanks.

Teddy

----- Original Message ----- 
From: "Charles K. Clarkson" <[EMAIL PROTECTED]>
To: <beginners@perl.org>
Sent: duminica, 20 martie 2005 08:24 AM
Subject: RE: Running a perl program offline


Octavian Rasnita <mailto:[EMAIL PROTECTED]> wrote:
: Hi,
:
: I have tried the following script:
:
: use CGI;
: my $q = new CGI;
:
: print "Content-type: text/html\n\nTestare\n";
: $q->redirect("http://localhost/";);

    That doesn't look right. When I run it, I don't get a redirect.
I get a text page with Testare on it. I'm running Apache on windows
XP.

    I think printing the redirect is the most reliable way to
redirect a page. It makes sense too. The redirect should be in the
header. You can't print the header more than one.


use CGI;
my $q = new CGI;

print $q->redirect( 'http://localhost/' );

HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to