Click here to get back home

HTML::Template not outputting

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
HTML::Template not outputting gmail 02-25-2008
Posted by gmail on February 25, 2008, 3:11 pm
Please log in for more thread options
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..."

Posted by Tony Mc on February 26, 2008, 9:50 am
Please log in for more thread options
On Mon, 25 Feb 2008 12:11:11 -0800 (PST), gmail@indigorobot.com 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

Posted by Mumia W. on February 26, 2008, 10:29 am
Please log in for more thread options
On 02/25/2008 02:11 PM, gmail@indigorobot.com wrote:
> Hello all.. I'm having trouble getting HTML::Template to output.

Hello.

> [...]
> warn "outputting template...\n\n";
> print "Content-Type: text/html\n\n";
> print "Print test from script...\n\n";
> $template->output();

You forgot to print the output:

print $template->output();

> [...]
> All that ends up being printed to the web browser is:
>
> "Print test from script..."


Similar ThreadsPosted
HTML::Template March 5, 2008, 2:40 pm
HTML::Template and __ODD__ July 22, 2005, 7:48 am
Mixing HTML::Template and GD::Graph May 14, 2005, 8:53 am
Namespace for new module: HTML::Template::HTX? May 13, 2005, 7:17 pm
HTML::Template arbitraryily nested recursive loops April 8, 2005, 2:59 pm
HTML::Template, is it possible to nest inside a ? June 4, 2007, 4:58 pm
install HTML::Template - Problem reading cache file / Bad file number July 24, 2004, 7:55 pm
[RFC] HTML::Dashboard (Spreadsheet-like formatting for HTML tables) April 16, 2007, 4:50 pm
Template Toolkit Beautifer September 8, 2006, 2:22 pm
Recall::Template - new module proposal March 14, 2007, 3:21 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap