For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > June 2006 > Re: Problems with HTML::Template









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Problems with HTML::Template
Sfantar

2006-06-20, 7:56 am

Prabu a écrit :
> sfantar wrote:
> Hello ,
>
> Try with this example(change the file permission) and if you still get
> the error message.Paste the error from "/var/log/httpd/error_log" .
>
> $ cat templ.tmpl
>
> <html>
> <head><title>Test Template</title>
> <body>
> My Name is <TMPL_VAR NAME=name>
> <p>
> This is a simple Example <TMPL_VAR NAME=example>
> </body>
> </html>
>
> $ cat templ.cgi
>
> #!/usr/bin/perl -w
> use HTML::Template;
>
> # open the html template
> my $template = HTML::Template->new(filename => 'templ.tmpl');
>
> # fill in some parameters
> $template->param(name => "Prabu");
> $template->param(example => "For Template");
>
> # send the obligatory Content-Type and print the template output
> print "Content-Type: text/html\n\n", $template->output;
>
> $ perl templ.cgi
>
> Content-Type: text/html
>
> <html>
> <head><title>Test Template</title>
> <body>
> My Name is Prabu
> <p>
> This is a simple Example For Template
> </body>
> </html>
>
> -- Prabu.M.A
>


While trying your solution, I got the same error as mentioned above.
But if I give the full path to templ.tmpl in the script, then it works !
Thanks for your help.
By the way, where can I find how Perl is configured on my webserver?
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com