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!


In reply to HTML::Template and Spaces by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.