Howdy all.

I see that this sort of question has been asked a few times in the resources
listed around, but I'm finding myself with a slightly different incarnation
of the 'my headers aren't working right' problem.

Basically I can't use the CGI modules header() function, and I don't know why
not.  I do a print "content-type: text/html\n\n" with PerlSendHeader both On
or Off and my perl script (simple hello world) works dandy.  But doing a
print header() results in the content type in the headers being sent as an
"application/x-perl" and netscape prompting me to save the .pl file.

Now from what I understood from the faq, mailing list archives and so on,
this shouldn't happen.  I should be able to take a perl .cgi and move it over
to mod_perl with minimul problems.  Now other parts of the CGI module
(param(), dump(), etc) work fine. 

Here's the skinny:
My hello.pl (in /var/www/perl/)
-----------------------
#!/usr/bin/perl -w

use strict;
use CGI;

my $q = new CGI;

#print $q->header(-type=>'text/html', -nph=>1);   # Line 1
print "Content-Type: text/html\n\n";              # Line 2

print "Hello World<P>";
-----------------------

My httpd.conf perl section
-----------------------
<FilesMatch ".pl$">
    SetHandler  perl-script
    PerlHandler Apache::Registry
    PerlSendHeader Off
    Options     ExecCGI
</FilesMatch>
-----------------------

So if I comment out line 2 in the .pl file and and uncomment line 1, I get
promted to save a application/x-perl (which matches the pl pm line in my
mime.types file incidently, but I'm not sure that has anything to do with
this).

The result of a lynx -mime_header WITHOUT using $q->header():
-------------------------
fishbowl:/var/www/perl# lynx -mime_header http://localhost
HTTP/1.1 200 OK
Date: Sat, 08 Jan 2000 09:56:10 GMT
Server: mod_perl/1.16 Apache/1.3.3 (Unix) Debian/GNU PHP/3.0.5 mod_perl/1.16
Connection: close
Content-Type: text/html

Hello World<P>
fishbowl:/var/www/perl#
-------------------------

.. and with $q->header()
-------------------------
fishbowl:/var/www/perl# lynx -mime_header http://localhost/perl/hello.pl
HTTP/1.1 200 OK
Date: Sat, 08 Jan 2000 09:58:00 GMT
Server: mod_perl/1.16 Apache/1.3.3 (Unix) Debian/GNU PHP/3.0.5 mod_perl/1.16
Connection: close
Content-Type: application/x-perl

Content-type: text/html

Hello World<P>
fishbowl:/var/www/perl#
-------------------------

I've scoured the net, faqs, and archives all night to no avail.  I hope
someone here can help me with a better answer than 'just print out the
content-type yourself' :) 

My system is a debian box running a stable distro with apache 1.3.3 and
mod_perl 1.16.

Thanks a million.
-- 
Alan  -=|=- <[EMAIL PROTECTED]> -=|=- http://arcterex.ufies.org
If you sell diamonds, you cannot expect to have many customers.
But a diamond is a diamond even if there are no customers.
                -- Swami Prabhupada

Reply via email to