develooper Front page | perl.beginners | Postings from May 2012

Re: Template toolkit issue

Thread Previous | Thread Next
From:
Lawrence Statton
Date:
May 2, 2012 08:01
Subject:
Re: Template toolkit issue
Message ID:
4FA14C3E.905@cluon.com
On 05/02/2012 09:55 AM, Mark Haney wrote:
> On 05/02/2012 10:44 AM, Robert Wohlfarth wrote:
>> On Wed, May 2, 2012 at 9:19 AM, Lawrence Statton<lawrence@cluon.com>
>> wrote:
>>
>>>
>>> Whitespace between the end of the HTTP headers and te beginning of HTML
>>> content is immaterial.
>>>
>>
>> Does the test script send back HTTP headers? The description sounds like
>> the script just generates the HTML document - no HTTP headers. I would
>> expect the script to run Template Toolkit, capture the results, and
>> include
>> those results in an HTTP response.
>>
>
> That is a good question. Keep in mind I'm following (to the letter,
> mostly) the Tutorial for dynamic script generation straight from the
> developer. The basic CGI script is below (slightly modified to
> accommodate my basic setup.
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> use Template;
>
> my $file = 'index.html';
> my $vars = {
> message => "System Test\n"
> };
>
> my $template = Template->new({
> # where to find template files
> INCLUDE_PATH => ['/home/markh/work/epic.git/code/embmon-web/src',
> '/home/markh/work/epic.git/code/embmon-web/lib'],
> # pre-process lib/config to define any extra values
> PRE_PROCESS => ['config','header'],
> POST_PROCESS => 'footer'
> });
>
> $template->process($file, $vars)
> || die "Template process failed: ", $template->error(), "\n";
>
>
> And attached is the exact HTML output of the script copied and pasted
> directly from the browser output. That output, btw, renders on the
> server just fine when I open the file directly.
>
>


I see nowhere in this code where you are producing HTTP headers.

Are you calling this as a CGI?  Which web server?


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About