Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This is my first post so feel free to critique me etiquette as well. My problem is the html outfile producing strings cutoff at the first space in the Records Loop. Here's the short program preceding the template it's supposed to fill out:
PROGRAM
#!/usr/bin/env perl use v5.16.3; use strict; use warnings; use autodie; use Data::Dump qw(dump); use HTML::Template; my $template = HTML::Template->new(filename => 'test.tmpl'); open FILE, ">", "output.html"; $template->param(RECORDS => [ {LINENUMBER => "1", CHARACTER => "Sid", TEXT => "this only prints +the first word"}, {LINENUMBER => "2", CHARACTER => "Sid", TEXT => "this only prints +the first word"}, {LINENUMBER => "3", CHARACTER => "Sid", TEXT => "this only prints +the first word"}, ]); print FILE "Content-Type: text/html\n\n", $template->output; close FILE;
HTML Template
<html> <head><title>Test Template</title></head> <body> <h1>The Script</h1> <TABLE><BORDER=5> <TR> <TH>Line No.</TH> <TH>Character</TH> <TH>Text</TH> </TR> <TMPL_LOOP NAME=RECORDS> <TR> <TD> <INPUT TYPE=TEXT NAME=LINENOINPUT VALUE=<TMPL_VAR NAME=LI +NENUMBER> > </TD> <TD> <INPUT TYPE=TEXT NAME=CHARACTERINPUT VALUE =<TMPL_VAR NAM +E=CHARACTER> > </TD> <TD> <INPUT TYPE=TEXT NAME=TEXTINPUT VALUE=<TMPL_VAR NAME=TEXT +> > </TD> </TR> </TMPL_LOOP> <TR> <TD> <INPUT TYPE=TEXT VALUE="This value works"> </TD> </TR> </TABLE> </body> </html>
<INPUT TYPE=TEXT NAME=TEXTINPUT VALUE=<TMPL_VAR NAME=TEXT>
will print out "This"
<INPUT TYPE=TEXT VALUE="This value works">
will print out the full string.
Thanks for your help!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML::Template and Spaces
by toolic (Bishop) on Aug 19, 2013 at 18:46 UTC | |
|
Re: HTML::Template and Spaces
by RichardK (Parson) on Aug 19, 2013 at 18:41 UTC | |
|
Re: HTML::Template and Spaces
by locked_user sundialsvc4 (Abbot) on Aug 19, 2013 at 18:50 UTC |