Robert wrote:
Hi list,
I am testing HTML::Template with a sample script, I can run the script from command line which is working fine but when I run it from browser (http://webserver/cgi-bin/test1-cgi) I am getting the following error


  Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

------------------------------------------------------------------------
Apache/1.3.26 Server at aegdbs001.aegislink.com Port 80



I checked in the web server logs, I see the following errors in the error log

[Tue Aug 3 10:47:11 2004] [error] [client 10.15.18.120] malformed header from s
cript. Bad header=<HTML>: /var/apache/cgi-bin/test1-cgi
[Tue Aug 3 11:34:52 2004] [error] [client 10.15.18.120] malformed header from s
cript. Bad header=<HTML>: /var/apache/cgi-bin/test1-cgi
Script test1-cgi
#!/usr/bin/perl
use HTML::Template;
# open the html template
my $template = HTML::Template->new(filename => '/home/raj/www/test/test.tmpl');
# fill in some parameters
$template->param(
HOME => $ENV{HOME},
PATH => $ENV{PATH},
);
# print the template
print $template->output;
Template:
bash-2.03$ cat test.tmpl
<HTML>
<HEAD><TITLE>Test Template</TITLE>
<BODY>
My Home Directory is <TMPL_VAR NAME=HOME>
<P>
My Path is set to <TMPL_VAR NAME=PATH>
</BODY>
</HTML>
Anyone know what could be the problem?.
Thanks in advance

yeah, you need to print a 'content-type' header before you print anything else. Any content passed over the web needs one.

    print "content-type: text/html\n\n";

just like that before you print anything else. Or you could use CGI.pm
like this...

    use CGI;
    my $q = CGI->new();
    print $q->header();

HTH

Michael Peters
Developer
Plus Three, LP



-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to