Re: HTML::Template not outputting



On Mon, 25 Feb 2008 12:11:11 -0800 (PST), gmail@xxxxxxxxxxxxxxx wrote:

Hello all.. I'm having trouble getting HTML::Template to output. Here
is a simple script and config snippet:

----------------------------------------------------------------------------------------------------------------------
Script (index.pl):

#!/usr/bin/perl -w

#Load some helpful functions
use strict; #strict tolerance for code
use warnings; #extra warnings in the log
use Carp; #verbose logging
use diagnostics; #more verbose logging

#Loadup some functions for later use
use HTML::Template;

my $template = HTML::Template->new( filename => "/var/www/html/
index.tmpl");
warn "outputting template...\n\n";
print "Content-Type: text/html\n\n";
print "Print test from script...\n\n";
$template->output();
----------------------------------------------------------------------------------------------------------------------
Config:

<Location />
AllowOverride None
Options MultiViews ExecCGI
DirectoryIndex index.pl
SetHandler perl-script
PerlHandler ModPerl::Registry
PerlSendHeader On
Allow from all
Deny from none
</Location>
----------------------------------------------------------------------------------------------------------------------
index.tmpl:

<br /><br />
Template Output
<br /><br />

----------------------------------------------------------------------------------------------------------------------
All that ends up being printed to the web browser is:

"Print test from script..."

Hi,

I think you need:
print $template->output();
rather than the $template->output(); in your programme.

Best,
Tony
.



Relevant Pages

  • HTML::Template not outputting
    ... Script: ... #extra warnings in the log ... "Print test from script..." ...
    (comp.lang.perl.modules)
  • file locking : does the os do this ?
    ... I have seen that Perl offers locking mechanisms, ... but I usually see them in the context of random I/O file handling (and ... Am I wrong and do I have to include file locking in my script when using ... print TEST "hello"; ...
    (comp.lang.perl.misc)