Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: HTML::Template error message

by bassplayer (Monsignor)
on Jun 22, 2004 at 16:49 UTC ( #368784=note: print w/replies, xml ) Need Help??

in reply to HTML::Template error message

$tmpl_obj->param( LOGIN_URL => '/cgi-bin/Auth/Auth.cgi', EMAIL => $cgi->param('email'), PASSWD => '', RM => $nextrm, );

In this code snippet, you are passing a hash to the param() method. The error is due to the fact that one of your variables is undefined (or is a list, as Sidhekin points out below). Check the values of $cgi->param('email') and $nextrm to ensure that they are populated properly before passing the hash.

Update: Here's a related node.


Replies are listed 'Best First'.
Re^2: HTML::Template error message
by Anonymous Monk on Jun 22, 2004 at 17:06 UTC
    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.

      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, );


      (the triplet paradiddle with high-hat)
      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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://368784]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2018-05-26 14:14 GMT
Find Nodes?
    Voting Booth?