Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Just another Perl shrine
 
PerlMonks  

no output from template toolkit

by BrianC (Acolyte)
on Jul 07, 2006 at 19:53 UTC ( [id://559882]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

BrianC has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I'm trying to convert some templates from HTML::Template to TT, but I'm having trouble getting out of the gate. I can't seem to get TT to produce any output, and error logs don't seem to show any problem. This is the test code I'm using:
#!/usr/bin/perl -wT use strict; use Template; use CGI; my $q = CGI->new; print $q->header("text/html"); my $template = Template->new({INCLUDE_PATH => '/home/xxxx/yyy/zzzz'}); my $vars = { message => 'Hello', }; $template->process('test.html', $vars);
and test.html
<html> <head> <title>TestPage</title> </head> <body> <h1>Test Message</h1> <p>[% message %]</p> <p>That's it</p> </body> </html>
And, as I've said, get no output except the content type header. Thanks for any help, Brian

Replies are listed 'Best First'.
Re: no output from template toolkit
by jbisbee (Pilgrim) on Jul 07, 2006 at 20:08 UTC
    When in doubt, check for exceptions...
    #!/usr/bin/perl -wT use strict; use Template; use CGI; my $q = CGI->new; print $q->header("text/html"); my $template = Template->new( { INCLUDE_PATH => '/home/xxxx/yyy/zzzz' +} ) || die Template->error(), "\n"; my $vars = { message => 'Hello', }; $template->process( 'test.html', $vars ) || die $template->error();
    returns
    Content-Type: text/html; charset=ISO-8859-1 file error - test.html: not found
    Maybe you shoud just need to set your "INCLUDE_PATH" to the correct location of your test.html file?

    -biz-

      Thank you very much!

      OK, shame on me for not doing that error checking. I am beating my head with a stone tablet as we speak

      Brian

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://559882]
Approved by TStanley
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.