No, you need a content-type header. the header need to send out, before the content.
#!/usr/bin/perl
use CGI qw(:standard);
use strict;
sub printpage();
print header( -type => 'text/html');
printpage();
exit;
| [reply] [d/l] |
Boris, Joost,
thanks for the help and patience. I had overlooked this in the HTML 4.01 spec. I guess the servers/user agents I've been using have been too forgiving !
Regards,
mP.
| [reply] |
No.DOCTYPE declarations are ADDITIONAL to the content-type. If you set content-type to "text/plain" for instance, the browser should ignore any markup in the file and just show it as plain text with funny tags in it.
You need a valid content-type header. Sometimes this is automatically provided by the webserver, but most of the time, it isn't.
Also, you might have uploaded your perl script as binary with different line-endings than the line-endings on the target machine, or your script is not executable by the webserver user (do chmod 755 filename).
| [reply] |
Ouch - this is embarrassing ...
I have recently started using LeechFTP which has no options on what the line-endings are.
To check the line-endings (also initially suggested by ccn) I did the upload via the command prompt and that has resolved the problem.
Thank you all very much for your time and expertise.
| [reply] |