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

Re: Template toolkit issue

Thread Previous | Thread Next
From:
Mark Haney
Date:
May 2, 2012 07:56
Subject:
Re: Template toolkit issue
Message ID:
4FA14AF1.9010607@abemblem.com
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.
-- 

Mark Haney
Software Developer/Consultant
AB Emblem
markh@abemblem.com
Linux marius.homelinux 3.3.2-6.fc16.x86_64 GNU/Linux


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