Hi.


I'm having problems with scalarref.



I get the following error:



### HTML::Template Debug ### In _parse:

HTML::Template->new() : Syntax error in <TMPL_*> tag at 
/fake/path/for/non/file/template : 1. at 
/usr/lib/perl5/site_perl/5.8.0/HTML/Template.pm line 2243.



Here's my template:

<TMPL_LOOP NAME=EMPLOYEE_INFO>

Name: <TMPL_VAR NAME=NAME> <br>

Job: <TMPL_VAR NAME=JOB> <p>

</TMPL_LOOP>



Here's my code:



#!/usr/bin/perl



use strict;

use warnings;



use HTML::Template;



my $tmpl;

$tmpl = &get_template($tmpl);

$tmpl = &populate_template($tmpl);



sub get_template {



my $file = "/tmp/page1.tmpl";

open (TMPL, $file)

or die "Failed to open template '$file': $!";



# Slurp file into scalar

my $html = join ('', <TMPL>);



close (TMPL)

or warn "Failed to close template '$file': $!";



return $html;



}



sub populate_template {



my $html = shift;



my $template = HTML::Template->new(

scalarref => \$html,

option => 'value',

debug => 1

);



return $template->output;



}

# end code



The template works fine if I use

filename => "/tmp/page1.tmpl"

instead of scalarref :/



Any ideas?



THANKS






___________________________________________________ 
Take your business online with Officemaster. Sign up for a free trial today!

http://www.officemaster.net



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to