Hello again.

BACKGROUND:
I'm trying to use that code in ahmad's reply to add reCaptcha to a form in a template file. That template file is a static file, not a Perl executable file like .pl nor .pm.

===

Within the form code section in that template file, I added a placeholder in hopes of adding and executing a single Perl statement once that template file was called by the .pm file. I've renamed that placeholder from <TMPL_VAR NAME="PERLCODE"> to <RECAPTCHA>.

I tried adding the Perl statements as shown below inside of the .pm file that calls the template file, but with each version I tried, it generated a 'Software Error' pointing to the '$t->param...' statement. There's other code prior to this code I added.

use HTML::Template; use Captcha::reCAPTCHA; my $c = Captcha::reCAPTCHA->new; my $t = HTML::Template->new( scalarref => \$template_file ); $t->param( <RECAPTCHA> => "print $c->get_html( 'your public key here' +);" ); $Output = $t->output;
(NOTE: I substituted the key for 'your public key here'.)

This routine is part of a subroutine where the final $Output var is returned.

What might be done to get this to work?

Thanks.

In reply to Re^3: How? Use new() from HTML::Template by newbie00
in thread How? Use new() from HTML::Template by newbie00

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.