in reply to Re: HTML::Template error message
in thread HTML::Template error message

Actually, the problem is that HTML::Template (whether or not it has anything to do with CGI::Application, I don't know) doesn't like:
EMAIL => $cgi->param('email'),
I changed it to:
EMAIL => $email,
and it works fine now. However, it seems to me that the original version should work. Why doesn't it interpolate correctly? I ran into a similar interpolation problem on one of my other template pages in the same application.

Replies are listed 'Best First'.
Re^3: HTML::Template error message
by jeffa (Bishop) on Jun 22, 2004 at 17:25 UTC

    Why are you passing the CGI parameters back to the template like that. Just use

    my $cgi = CGI->new(); my $template = HTML::Template->new( filename => 'foo.tmpl', associate => $cgi, );
    when you instantiate the H::T object instead. Of course, you have to take care with multiple values, as usual. Check out the HTML::Template Tutorial if you already haven't and good luck. :)

    UPDATE: I suppose i should post the relevant CGI::Application code instead :O

    my $tmpl_obj = $webapp->load_tmpl('some_other.tmpl', associate => $cgi, );

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
Re^3: HTML::Template error message
by BUU (Prior) on Jun 22, 2004 at 21:54 UTC
    Because $cgi->param(x) in list returns an empty list. In scalar context it returns undef. So when you include it in the H::T->param call, it's in list context and effectively doesn't exist. When you assign it to a scalar first you get undef, which is an item in the list.