It looks to me like you're doing everything twice. You've got "all my form data" in %cgi_vars? Haven't you also got all your form data in your $q object? You're taking your form data out, changing it then putting in back, then putting it into the HTML::Template object?

You're doing everything three times, come to think of it.

Your form data can be accessed by using your CGI object. Your CGI object's parameters can be changed in place, and your CGI object's parameters can be inserted directly into your HTML::Template object. So why do we need this other hash? Some simple code:

#!/usr/bin/perl use CGI qw(:standard); my $q = CGI->new(); ## all your form data is now in $q use HTML::Template; my $template = HTML::Template->new( filename => '/path/to/file.tmpl' ); $q->param( -name => 'foo', -value => uc( $q->param( 'foo' ) ) ); ## change a parameter in-place $template->param( templatefoo => $q->param( 'foo' ), templatebar => $q->param( 'bar' ) ); # insert whichever form data you need into the template print $q->header(); print $template->output(); # and we're done


($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
=~y~b-v~a-z~s; print

In reply to Re: Using associate with HTML::Template by Cody Pendant
in thread Using associate with HTML::Template by nedals

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.