Use a scalar ref with the template contents as described in the Template documentation.
#THIS IS THE TEST.PL use strict; use warnings; use Template; my @names = qw/ Foo Bar Moo /; my $template = Template->new; my $templ = <<START_HTML; <!DOCTYPE html"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> <title>Untitled Document</title> </head> <body> [% FOREACH name IN list %] <li> <div class='inforno'> <img src='inforno'> </div> <div class='inforno'> <a href='#' class='inforno'>[% name %]</a> </div> <span class='inforno'> <a href='#' class='inforno'>Edit user</a> </span> </li> [% END %] </body> </html> START_HTML $template->process (\$templ, { list => \@names }) or die $template->error;
In reply to Re: using template on same page
by hippo
in thread using template on same page
by bigup401
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |